From 15267ea2d489606fb4b99d011bc3ea7c2a644a9f Mon Sep 17 00:00:00 2001 From: George Hazan Date: Sun, 17 Mar 2013 14:22:17 +0000 Subject: fix for popup-related memory leaks git-svn-id: http://svn.miranda-ng.org/main/trunk@4077 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- plugins/BasicHistory/src/Scheduler.cpp | 29 +++++++++++++++++------------ 1 file changed, 17 insertions(+), 12 deletions(-) (limited to 'plugins/BasicHistory/src') diff --git a/plugins/BasicHistory/src/Scheduler.cpp b/plugins/BasicHistory/src/Scheduler.cpp index a317a7dac4..d408563e72 100644 --- a/plugins/BasicHistory/src/Scheduler.cpp +++ b/plugins/BasicHistory/src/Scheduler.cpp @@ -56,26 +56,31 @@ bool FtpGetFiles(const std::wstring& dir, const std::list& files, void CreatePath(const TCHAR *szDir); void DoError(const TaskOptions& to, const std::wstring error); +static HANDLE hPopupClass; + void OptionsSchedulerChanged() { StartThread(false); } +static int OnShutdown(WPARAM, LPARAM) +{ + Popup_UnregisterClass(hPopupClass); + return 0; +} + void InitScheduler() { bPopupsEnabled = ServiceExists(MS_POPUP_ADDPOPUPT) || ServiceExists(MS_POPUP_ADDPOPUPCLASS); - if (ServiceExists(MS_POPUP_REGISTERCLASS)) - { - //hPopupIcon = LoadIconEx(I_CHKUPD); - POPUPCLASS test = {0}; - test.cbSize = sizeof(POPUPCLASS); - test.flags = PCF_TCHAR; - test.hIcon = LoadSkinnedIcon(SKINICON_OTHER_HISTORY); - test.iSeconds = 10; - test.ptszDescription = TranslateT("History task"); - test.pszName = MODULE; - CallService(MS_POPUP_REGISTERCLASS, 0, (WPARAM)&test); - } + + POPUPCLASS test = { sizeof(test) }; + test.flags = PCF_TCHAR; + test.hIcon = LoadSkinnedIcon(SKINICON_OTHER_HISTORY); + test.iSeconds = 10; + test.ptszDescription = TranslateT("History task"); + test.pszName = MODULE; + if (hPopupClass = Popup_RegisterClass(&test)) + HookEvent(ME_SYSTEM_SHUTDOWN, OnShutdown); StartThread(true); } -- cgit v1.2.3