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 --- protocols/Gadu-Gadu/src/gg_proto.cpp | 3 +++ protocols/Gadu-Gadu/src/gg_proto.h | 1 + protocols/Gadu-Gadu/src/popups.cpp | 8 +++----- 3 files changed, 7 insertions(+), 5 deletions(-) (limited to 'protocols/Gadu-Gadu') diff --git a/protocols/Gadu-Gadu/src/gg_proto.cpp b/protocols/Gadu-Gadu/src/gg_proto.cpp index f753f2a863..af082ae1f3 100644 --- a/protocols/Gadu-Gadu/src/gg_proto.cpp +++ b/protocols/Gadu-Gadu/src/gg_proto.cpp @@ -93,6 +93,9 @@ GGPROTO::~GGPROTO() keepalive_destroy(); gc_destroy(); + Popup_UnregisterClass(hPopupError); + Popup_UnregisterClass(hPopupNotify); + if (hMenuRoot) CallService(MS_CLIST_REMOVEMAINMENUITEM, (WPARAM)hMenuRoot, 0); diff --git a/protocols/Gadu-Gadu/src/gg_proto.h b/protocols/Gadu-Gadu/src/gg_proto.h index 6bb5a1565c..d462f420f3 100644 --- a/protocols/Gadu-Gadu/src/gg_proto.h +++ b/protocols/Gadu-Gadu/src/gg_proto.h @@ -286,6 +286,7 @@ struct GGPROTO : public PROTO_INTERFACE HANDLE hAvatarsFolder; HANDLE hImagesFolder; HWND hwndSessionsDlg; + HANDLE hPopupNotify, hPopupError; }; typedef struct diff --git a/protocols/Gadu-Gadu/src/popups.cpp b/protocols/Gadu-Gadu/src/popups.cpp index 386435c973..fcd58ea3e9 100644 --- a/protocols/Gadu-Gadu/src/popups.cpp +++ b/protocols/Gadu-Gadu/src/popups.cpp @@ -79,9 +79,9 @@ void GGPROTO::initpopups() puc.cbSize = sizeof(puc); puc.PluginWindowProc = PopupWindowProc; puc.flags = PCF_TCHAR; - puc.ptszDescription = szDescr; puc.pszName = szName; + puc.colorBack = RGB(173, 206, 247); puc.colorText = GetSysColor(COLOR_WINDOWTEXT); puc.hIcon = CopyIcon(LoadIconEx("main", FALSE)); @@ -89,17 +89,15 @@ void GGPROTO::initpopups() puc.iSeconds = 4; mir_sntprintf(szDescr, SIZEOF(szDescr), _T("%s/%s"), m_tszUserName, TranslateT("Notify")); mir_snprintf(szName, SIZEOF(szName), "%s_%s", m_szModuleName, "Notify"); - CallService(MS_POPUP_REGISTERCLASS, 0, (WPARAM)&puc); + hPopupNotify = Popup_RegisterClass(&puc); - puc.ptszDescription = szDescr; - puc.pszName = szName; puc.colorBack = RGB(191, 0, 0); // Red puc.colorText = RGB(255, 245, 225); // Yellow puc.iSeconds = 60; puc.hIcon = (HICON)LoadImage(NULL, IDI_WARNING, IMAGE_ICON, 0, 0, LR_SHARED); mir_sntprintf(szDescr, SIZEOF(szDescr), _T("%s/%s"), m_tszUserName, TranslateT("Error")); mir_snprintf(szName, SIZEOF(szName), "%s_%s", m_szModuleName, "Error"); - CallService(MS_POPUP_REGISTERCLASS, 0, (WPARAM)&puc); + hPopupError = Popup_RegisterClass(&puc); } ///////////////////////////////////////////////////////////////////////////////////////// -- cgit v1.2.3