diff options
author | George Hazan <george.hazan@gmail.com> | 2013-03-17 14:22:17 +0000 |
---|---|---|
committer | George Hazan <george.hazan@gmail.com> | 2013-03-17 14:22:17 +0000 |
commit | 15267ea2d489606fb4b99d011bc3ea7c2a644a9f (patch) | |
tree | 607fb948632ec8b348508cbd08ef41fffe21d8c2 /plugins/BasicHistory/src/Scheduler.cpp | |
parent | 5e6e1e8838fe7637ef588e0fb080ad07fc5700aa (diff) |
fix for popup-related memory leaks
git-svn-id: http://svn.miranda-ng.org/main/trunk@4077 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins/BasicHistory/src/Scheduler.cpp')
-rw-r--r-- | plugins/BasicHistory/src/Scheduler.cpp | 29 |
1 files changed, 17 insertions, 12 deletions
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<std::wstring>& 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);
}
|