summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMikalaiR <nikolay.romanovich@narod.ru>2015-10-03 19:24:25 +0000
committerMikalaiR <nikolay.romanovich@narod.ru>2015-10-03 19:24:25 +0000
commit752b3c8dfc49974b3570a3ca272ff5ef6945c6f4 (patch)
treef0e682cd310ef393b7745bb0acaca5635d92d4ed
parent5cc4efdb400e1c27c705cddae25a416d5c26e99d (diff)
Toaster: crash fix
git-svn-id: http://svn.miranda-ng.org/main/trunk@15505 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
-rw-r--r--plugins/Toaster/src/services.cpp11
-rw-r--r--plugins/Toaster/src/toast_event_handler.cpp4
2 files changed, 14 insertions, 1 deletions
diff --git a/plugins/Toaster/src/services.cpp b/plugins/Toaster/src/services.cpp
index d930426906..3f701b86f9 100644
--- a/plugins/Toaster/src/services.cpp
+++ b/plugins/Toaster/src/services.cpp
@@ -261,7 +261,16 @@ static INT_PTR ShowMessage(WPARAM wParam, LPARAM lParam)
static INT_PTR HideToast(WPARAM, LPARAM lParam)
{
- static_cast<ToastNotification*>(reinterpret_cast<ToastEventHandler*>(lParam)->GetToastNotification())->Hide();
+ extern LIST<ToastEventHandler> lstHandlers;
+ ToastEventHandler* handler = reinterpret_cast<ToastEventHandler*>(lParam);
+ if (lstHandlers.getIndex(handler) != -1)
+ {
+ ToastNotification* notification = static_cast<ToastNotification*>(handler->GetToastNotification());
+ if (lstNotifications.getIndex(notification) != -1)
+ {
+ notification->Hide();
+ }
+ }
return 0;
}
void __stdcall HideAllToasts(void*)
diff --git a/plugins/Toaster/src/toast_event_handler.cpp b/plugins/Toaster/src/toast_event_handler.cpp
index 6248cf9eaa..33a3c3e1c3 100644
--- a/plugins/Toaster/src/toast_event_handler.cpp
+++ b/plugins/Toaster/src/toast_event_handler.cpp
@@ -3,13 +3,17 @@
using namespace ABI::Windows::UI::Notifications;
using namespace Microsoft::WRL;
+LIST<ToastEventHandler> lstHandlers(2, PtrKeySortT);
+
ToastEventHandler::ToastEventHandler(_In_ ToastHandlerData *pData) : _ref(0), _thd(pData)
{
+ lstHandlers.insert(this);
CallPopupProc(UM_INITPOPUP);
}
ToastEventHandler::~ToastEventHandler()
{
+ lstHandlers.remove(this);
CallPopupProc(UM_FREEPLUGINDATA);
}