From 10aaf104c7ad7f89fbc1a9eda713c99b21fdcfa2 Mon Sep 17 00:00:00 2001 From: MikalaiR Date: Sun, 30 Aug 2015 10:31:02 +0000 Subject: Toaster: fixes git-svn-id: http://svn.miranda-ng.org/main/trunk@15115 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- plugins/Toaster/src/main.cpp | 7 +------ plugins/Toaster/src/services.cpp | 19 +++++++++++-------- plugins/Toaster/src/stdafx.h | 1 + 3 files changed, 13 insertions(+), 14 deletions(-) diff --git a/plugins/Toaster/src/main.cpp b/plugins/Toaster/src/main.cpp index 66db53929e..007391119b 100644 --- a/plugins/Toaster/src/main.cpp +++ b/plugins/Toaster/src/main.cpp @@ -61,11 +61,6 @@ extern "C" int __declspec(dllexport) Unload(void) int OnPreShutdown(WPARAM, LPARAM) { - mir_cslock lck(csNotifications); - for (int i = 0; i < lstNotifications.getCount(); i++) - lstNotifications[i].Hide(); - - lstNotifications.destroy(); - + HideAllToasts(); return 0; } \ No newline at end of file diff --git a/plugins/Toaster/src/services.cpp b/plugins/Toaster/src/services.cpp index a2747758e8..9c3d4b12bd 100644 --- a/plugins/Toaster/src/services.cpp +++ b/plugins/Toaster/src/services.cpp @@ -111,14 +111,7 @@ static INT_PTR PopupQuery(WPARAM wParam, LPARAM) { bool enabled = db_get_b(0, "Popup", "ModuleIsEnabled", 1) != 0; if (enabled) db_set_b(0, "Popup", "ModuleIsEnabled", 0); - - mir_cslock lck(csNotifications); - while (lstNotifications.getCount()) - { - lstNotifications[0].Hide(); - lstNotifications.remove(0); - } - + HideAllToasts(); return enabled; } break; @@ -131,6 +124,16 @@ static INT_PTR PopupQuery(WPARAM wParam, LPARAM) } } +void HideAllToasts() +{ + mir_cslock lck(csNotifications); + while (lstNotifications.getCount()) + { + lstNotifications[0].Hide(); + lstNotifications.remove(0); + } +} + void InitServices() { CreateServiceFunction(MS_POPUP_ADDPOPUP, CreatePopup); diff --git a/plugins/Toaster/src/stdafx.h b/plugins/Toaster/src/stdafx.h index d198146e97..f763765039 100644 --- a/plugins/Toaster/src/stdafx.h +++ b/plugins/Toaster/src/stdafx.h @@ -43,4 +43,5 @@ struct callbackArg void InitServices(); int OnPreShutdown(WPARAM, LPARAM); +void HideAllToasts(); #endif //_COMMON_H_ -- cgit v1.2.3