From 0a8afde40e4061f7ec46b87aa9a0dbfdee1e7847 Mon Sep 17 00:00:00 2001 From: MikalaiR Date: Wed, 6 Jan 2016 10:29:33 +0000 Subject: Toaster: crash fix(?) git-svn-id: http://svn.miranda-ng.org/main/trunk@16030 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- plugins/Toaster/src/services.cpp | 6 ++++-- plugins/Toaster/src/toast_notification.cpp | 3 ++- 2 files changed, 6 insertions(+), 3 deletions(-) (limited to 'plugins/Toaster/src') diff --git a/plugins/Toaster/src/services.cpp b/plugins/Toaster/src/services.cpp index 7f25162755..269cc63da0 100644 --- a/plugins/Toaster/src/services.cpp +++ b/plugins/Toaster/src/services.cpp @@ -228,14 +228,16 @@ static INT_PTR ShowMessage(WPARAM wParam, LPARAM lParam) static INT_PTR HideToast(WPARAM, LPARAM lParam) { ToastNotification* pNotification = reinterpret_cast(lParam); + mir_cslock lck(csNotifications); if (lstNotifications.getIndex(pNotification) != -1) - pNotification->Destroy(); + lstNotifications.remove(pNotification); return 0; } void __stdcall HideAllToasts(void*) { + mir_cslock lck(csNotifications); while (lstNotifications.getCount()) - lstNotifications[0].Destroy(); + lstNotifications.remove(0); } void InitServices() diff --git a/plugins/Toaster/src/toast_notification.cpp b/plugins/Toaster/src/toast_notification.cpp index 0708be6ec4..2df72af9ad 100644 --- a/plugins/Toaster/src/toast_notification.cpp +++ b/plugins/Toaster/src/toast_notification.cpp @@ -28,6 +28,8 @@ ToastNotification::ToastNotification( ToastNotification::~ToastNotification() { + if (_pvPopupData != nullptr) + CallPopupProc(UM_FREEPLUGINDATA); notifier->Hide(notification.Get()); } @@ -106,7 +108,6 @@ HRESULT ToastNotification::OnFail(_In_ ABI::Windows::UI::Notifications::IToastNo void ToastNotification::Destroy() { - CallPopupProc(UM_FREEPLUGINDATA); mir_cslock lck(csNotifications); lstNotifications.remove(this); } \ No newline at end of file -- cgit v1.2.3