summaryrefslogtreecommitdiff
path: root/plugins/Ping/src/utils.cpp
diff options
context:
space:
mode:
authorGeorge Hazan <george.hazan@gmail.com>2013-03-17 14:22:17 +0000
committerGeorge Hazan <george.hazan@gmail.com>2013-03-17 14:22:17 +0000
commit15267ea2d489606fb4b99d011bc3ea7c2a644a9f (patch)
tree607fb948632ec8b348508cbd08ef41fffe21d8c2 /plugins/Ping/src/utils.cpp
parent5e6e1e8838fe7637ef588e0fb080ad07fc5700aa (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/Ping/src/utils.cpp')
-rw-r--r--plugins/Ping/src/utils.cpp34
1 files changed, 19 insertions, 15 deletions
diff --git a/plugins/Ping/src/utils.cpp b/plugins/Ping/src/utils.cpp
index 972d60845c..c87793fee8 100644
--- a/plugins/Ping/src/utils.cpp
+++ b/plugins/Ping/src/utils.cpp
@@ -300,11 +300,16 @@ void import_ping_addresses()
LeaveCriticalSection(&list_cs);
}
-HANDLE hIcoLibIconsChanged;
+HANDLE hPopupClass;
+HICON hIconResponding, hIconNotResponding, hIconTesting, hIconDisabled;
-HICON hIconResponding, hIconNotResponding, hIconTesting, hIconDisabled;
+static int OnShutdown(WPARAM, LPARAM)
+{
+ Popup_UnregisterClass(hPopupClass);
+ return 0;
+}
-int ReloadIcons(WPARAM wParam, LPARAM lParam)
+static int ReloadIcons(WPARAM wParam, LPARAM lParam)
{
hIconResponding = Skin_GetIcon("ping_responding");
hIconNotResponding = Skin_GetIcon("ping_not_responding");
@@ -332,16 +337,15 @@ void InitUtils()
hIconTesting = Skin_GetIcon("ping_testing");
hIconDisabled = Skin_GetIcon("ping_disabled");
- hIcoLibIconsChanged = HookEvent(ME_SKIN2_ICONSCHANGED, ReloadIcons);
-
- if (ServiceExists(MS_POPUP_REGISTERCLASS)) {
- POPUPCLASS test = { sizeof(test) };
- test.flags = PCF_TCHAR;
- test.hIcon = hIconResponding;
- test.iSeconds = -1;
- test.ptszDescription = TranslateT("Ping");
- test.pszName = "pingpopups";
- test.PluginWindowProc = NullWindowProc;
- CallService(MS_POPUP_REGISTERCLASS, 0, (WPARAM)&test);
- }
+ HookEvent(ME_SKIN2_ICONSCHANGED, ReloadIcons);
+
+ POPUPCLASS test = { sizeof(test) };
+ test.flags = PCF_TCHAR;
+ test.hIcon = hIconResponding;
+ test.iSeconds = -1;
+ test.ptszDescription = TranslateT("Ping");
+ test.pszName = "pingpopups";
+ test.PluginWindowProc = NullWindowProc;
+ if (hPopupClass = Popup_RegisterClass(&test))
+ HookEvent(ME_SYSTEM_PRESHUTDOWN, OnShutdown);
}