diff options
author | MikalaiR <nikolay.romanovich@narod.ru> | 2015-09-15 18:41:23 +0000 |
---|---|---|
committer | MikalaiR <nikolay.romanovich@narod.ru> | 2015-09-15 18:41:23 +0000 |
commit | 87208846a0e7fd82e246dd1e6a9cddfc0ca159e4 (patch) | |
tree | b62dc0dd3408762dc2d71efd1f8defa48a6af7ef | |
parent | cf54764e31db71613b9088aedcf2bcf32427391d (diff) |
Toaster: OBJLIST fix
git-svn-id: http://svn.miranda-ng.org/main/trunk@15360 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
-rw-r--r-- | plugins/Toaster/src/services.cpp | 2 | ||||
-rw-r--r-- | plugins/Toaster/src/toast_event_handler.cpp | 22 |
2 files changed, 16 insertions, 8 deletions
diff --git a/plugins/Toaster/src/services.cpp b/plugins/Toaster/src/services.cpp index fca3a833e8..79e7acca08 100644 --- a/plugins/Toaster/src/services.cpp +++ b/plugins/Toaster/src/services.cpp @@ -1,7 +1,7 @@ #include "stdafx.h"
mir_cs csNotifications;
-OBJLIST<ToastNotification> lstNotifications(1);
+OBJLIST<ToastNotification> lstNotifications(2, PtrKeySortT);
std::map<std::string, ClassData*> mp_Classes;
wchar_t wszTempDir[MAX_PATH];
diff --git a/plugins/Toaster/src/toast_event_handler.cpp b/plugins/Toaster/src/toast_event_handler.cpp index 6d9da3952f..c6682da954 100644 --- a/plugins/Toaster/src/toast_event_handler.cpp +++ b/plugins/Toaster/src/toast_event_handler.cpp @@ -14,7 +14,6 @@ ToastEventHandler::~ToastEventHandler() if (_thd->pPopupProc)
_thd->pPopupProc((HWND)this, UM_FREEPLUGINDATA, 0, 0);
- mir_cslock lck(csNotifications);
lstNotifications.remove(_thd->tstNotification);
}
@@ -26,7 +25,8 @@ IFACEMETHODIMP_(ULONG) ToastEventHandler::AddRef() IFACEMETHODIMP_(ULONG) ToastEventHandler::Release()
{
ULONG l = InterlockedDecrement(&_ref);
- if (l == 0) delete this;
+ if (l == 0)
+ delete this;
return l;
}
@@ -50,7 +50,10 @@ IFACEMETHODIMP ToastEventHandler::Invoke(_In_ IToastNotification * /*sender*/, _ {
if (_thd->pPopupProc)
_thd->pPopupProc((HWND)this, WM_COMMAND, 0, 0);
- delete this;
+
+ mir_cslock lck(csNotifications);
+ lstNotifications.remove(_thd->tstNotification);
+
return S_OK;
}
@@ -65,7 +68,7 @@ IFACEMETHODIMP ToastEventHandler::Invoke(_In_ IToastNotification* /* sender */, {
if (_thd->pPopupProc)
_thd->pPopupProc((HWND)this, WM_CONTEXTMENU, 0, 0);
- delete this;
+ //delete this;
break;
}
case ToastDismissalReason_UserCanceled:
@@ -73,18 +76,23 @@ IFACEMETHODIMP ToastEventHandler::Invoke(_In_ IToastNotification* /* sender */, if (_thd->pPopupProc)
_thd->pPopupProc((HWND)this, WM_CONTEXTMENU, 0, 0);
_thd->tstNotification->Hide();
- delete this;
+ //delete this;
break;
}
case ToastDismissalReason_TimedOut:
- delete this; // should be rewritten
+ //delete this; // should be rewritten
break;
}
+
+ mir_cslock lck(csNotifications);
+ lstNotifications.remove(_thd->tstNotification);
+
return S_OK;
}
IFACEMETHODIMP ToastEventHandler::Invoke(_In_ IToastNotification* /* sender */, _In_ IToastFailedEventArgs* /*e*/ )
{
- delete this;
+ mir_cslock lck(csNotifications);
+ lstNotifications.remove(_thd->tstNotification);
return S_OK;
}
\ No newline at end of file |