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 /protocols | |
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 'protocols')
-rw-r--r-- | protocols/Gadu-Gadu/src/gg_proto.cpp | 3 | ||||
-rw-r--r-- | protocols/Gadu-Gadu/src/gg_proto.h | 1 | ||||
-rw-r--r-- | protocols/Gadu-Gadu/src/popups.cpp | 8 | ||||
-rw-r--r-- | protocols/JabberG/src/jabber.h | 2 | ||||
-rw-r--r-- | protocols/JabberG/src/jabber_chat.cpp | 2 | ||||
-rw-r--r-- | protocols/JabberG/src/jabber_misc.cpp | 15 | ||||
-rw-r--r-- | protocols/JabberG/src/jabber_proto.cpp | 3 | ||||
-rw-r--r-- | protocols/JabberG/src/jabber_proto.h | 2 | ||||
-rw-r--r-- | protocols/MSN/src/msn_misc.cpp | 16 | ||||
-rw-r--r-- | protocols/MSN/src/msn_proto.cpp | 4 | ||||
-rw-r--r-- | protocols/MSN/src/msn_proto.h | 4 |
11 files changed, 31 insertions, 29 deletions
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);
}
/////////////////////////////////////////////////////////////////////////////////////////
diff --git a/protocols/JabberG/src/jabber.h b/protocols/JabberG/src/jabber.h index 36787c6fdb..1eedf528db 100644 --- a/protocols/JabberG/src/jabber.h +++ b/protocols/JabberG/src/jabber.h @@ -78,6 +78,8 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include <m_timezones.h>
#include <m_jabber.h>
#include <m_fingerprint.h>
+#include <m_popup.h>
+#include <m_folders.h>
#include <m_xstatus.h>
#include <m_extraicons.h>
#include <win2k.h>
diff --git a/protocols/JabberG/src/jabber_chat.cpp b/protocols/JabberG/src/jabber_chat.cpp index d33595adeb..4182cccb23 100644 --- a/protocols/JabberG/src/jabber_chat.cpp +++ b/protocols/JabberG/src/jabber_chat.cpp @@ -1357,7 +1357,7 @@ static void sttLogListHook(CJabberProto* ppro, JABBER_LIST_ITEM* item, GCHOOK* g mir_ptr<TCHAR> ptszBuf((TCHAR*)mir_alloc( sizeof(TCHAR) * cbLen));
if (item->itemResource.statusMessage) {
TCHAR *d = ptszBuf;
- for (int i = 0; i < cbLen; i++) {
+ for (int i = 0; i < (int)cbLen; i++) {
if (item->itemResource.statusMessage[ i ] != _T('\n') || (i && item->itemResource.statusMessage[ i - 1 ] == _T('\r')))
*d++ = item->itemResource.statusMessage[ i ];
else {
diff --git a/protocols/JabberG/src/jabber_misc.cpp b/protocols/JabberG/src/jabber_misc.cpp index 31f10ad5c5..0d8167fa89 100644 --- a/protocols/JabberG/src/jabber_misc.cpp +++ b/protocols/JabberG/src/jabber_misc.cpp @@ -26,9 +26,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include "jabber_list.h"
#include "jabber_caps.h"
-#include <m_popup.h>
-#include "m_folders.h"
-
///////////////////////////////////////////////////////////////////////////////
// JabberAddContactToRoster() - adds a contact to the roster
@@ -623,22 +620,20 @@ void CJabberProto::SetContactOfflineStatus(HANDLE hContact) void CJabberProto::InitPopups(void)
{
TCHAR desc[256];
+ mir_sntprintf(desc, SIZEOF(desc), _T("%s %s"), m_tszUserName, TranslateT("Errors"));
+
char name[256];
+ mir_snprintf(name, SIZEOF(name), "%s_%s", m_szModuleName, "Error");
- POPUPCLASS ppc = {0};
- ppc.cbSize = sizeof(ppc);
+ POPUPCLASS ppc = { sizeof(ppc) };
ppc.flags = PCF_TCHAR;
-
ppc.ptszDescription = desc;
ppc.pszName = name;
ppc.hIcon = LoadIconEx("main");
ppc.colorBack = RGB(191, 0, 0); //Red
ppc.colorText = RGB(255, 245, 225); //Yellow
ppc.iSeconds = 60;
- mir_sntprintf(desc, SIZEOF(desc), _T("%s %s"), m_tszUserName, TranslateT("Errors"));
- mir_snprintf(name, SIZEOF(name), "%s_%s", m_szModuleName, "Error");
-
- CallService(MS_POPUP_REGISTERCLASS, 0, (WPARAM)&ppc);
+ m_hPopupClass = Popup_RegisterClass(&ppc);
}
void CJabberProto::MsgPopup(HANDLE hContact, const TCHAR *szMsg, const TCHAR *szTitle)
diff --git a/protocols/JabberG/src/jabber_proto.cpp b/protocols/JabberG/src/jabber_proto.cpp index eb81e2002a..9958742177 100644 --- a/protocols/JabberG/src/jabber_proto.cpp +++ b/protocols/JabberG/src/jabber_proto.cpp @@ -215,6 +215,9 @@ CJabberProto::~CJabberProto() ConsoleUninit();
GlobalMenuUninit();
+ if (m_hPopupClass)
+ Popup_UnregisterClass(m_hPopupClass);
+
delete m_pInfoFrame;
DestroyHookableEvent(m_hEventNudge);
diff --git a/protocols/JabberG/src/jabber_proto.h b/protocols/JabberG/src/jabber_proto.h index f37f1f264d..44c1e3352c 100644 --- a/protocols/JabberG/src/jabber_proto.h +++ b/protocols/JabberG/src/jabber_proto.h @@ -991,6 +991,8 @@ private: DWORD m_lastTicks;
+ HANDLE m_hPopupClass;
+
HANDLE m_hJabberAvatarsFolder;
BOOL m_bFoldersInitDone;
diff --git a/protocols/MSN/src/msn_misc.cpp b/protocols/MSN/src/msn_misc.cpp index e6b86d244f..f39fe781c0 100644 --- a/protocols/MSN/src/msn_misc.cpp +++ b/protocols/MSN/src/msn_misc.cpp @@ -974,33 +974,27 @@ void CMsnProto::InitPopups(void) TCHAR desc[256];
char name[256];
- POPUPCLASS ppc = {0};
- ppc.cbSize = sizeof(ppc);
+ POPUPCLASS ppc = { sizeof(ppc) };
ppc.flags = PCF_TCHAR;
ppc.PluginWindowProc = NullWindowProc;
-
ppc.hIcon = LoadIconEx("main");
-
ppc.ptszDescription = desc;
ppc.pszName = name;
+
ppc.colorBack = RGB(173, 206, 247);
ppc.colorText = GetSysColor(COLOR_WINDOWTEXT);
ppc.iSeconds = 3;
mir_sntprintf(desc, SIZEOF(desc), _T("%s/%s"), m_tszUserName, TranslateT("Hotmail"));
mir_snprintf(name, SIZEOF(name), "%s_%s", m_szModuleName, "Hotmail");
- CallService(MS_POPUP_REGISTERCLASS, 0, (WPARAM)&ppc);
+ hPopupHotmail = Popup_RegisterClass(&ppc);
- ppc.ptszDescription = desc;
- ppc.pszName = name;
ppc.colorBack = RGB(173, 206, 247);
ppc.colorText = GetSysColor(COLOR_WINDOWTEXT);
ppc.iSeconds = 3;
mir_sntprintf(desc, SIZEOF(desc), _T("%s/%s"), m_tszUserName, TranslateT("Notify"));
mir_snprintf(name, SIZEOF(name), "%s_%s", m_szModuleName, "Notify");
- CallService(MS_POPUP_REGISTERCLASS, 0, (WPARAM)&ppc);
+ hPopupNotify = Popup_RegisterClass(&ppc);
- ppc.ptszDescription = desc;
- ppc.pszName = name;
ppc.hIcon = (HICON)LoadImage(NULL, IDI_WARNING, IMAGE_ICON, 0, 0, LR_SHARED);
ppc.colorBack = RGB(191, 0, 0); //Red
ppc.colorText = RGB(255, 245, 225); //Yellow
@@ -1008,7 +1002,7 @@ void CMsnProto::InitPopups(void) mir_sntprintf(desc, SIZEOF(desc), _T("%s/%s"), m_tszUserName, TranslateT("Error"));
mir_snprintf(name, SIZEOF(name), "%s_%s", m_szModuleName, "Error");
- CallService(MS_POPUP_REGISTERCLASS, 0, (WPARAM)&ppc);
+ hPopupError = Popup_RegisterClass(&ppc);
}
/////////////////////////////////////////////////////////////////////////////////////////
diff --git a/protocols/MSN/src/msn_proto.cpp b/protocols/MSN/src/msn_proto.cpp index 5b9872f84a..c1ed5e4f56 100644 --- a/protocols/MSN/src/msn_proto.cpp +++ b/protocols/MSN/src/msn_proto.cpp @@ -227,6 +227,10 @@ int CMsnProto::OnModulesLoaded(WPARAM, LPARAM) int CMsnProto::OnPreShutdown(WPARAM, LPARAM)
{
SetEvent(hevAvatarQueue);
+
+ Popup_UnregisterClass(hPopupError);
+ Popup_UnregisterClass(hPopupHotmail);
+ Popup_UnregisterClass(hPopupNotify);
return 0;
}
diff --git a/protocols/MSN/src/msn_proto.h b/protocols/MSN/src/msn_proto.h index e572663f0d..b9819eb099 100644 --- a/protocols/MSN/src/msn_proto.h +++ b/protocols/MSN/src/msn_proto.h @@ -187,10 +187,10 @@ struct CMsnProto : public PROTO_INTERFACE clock_t mStatusMsgTS;
HANDLE msnSearchId;
- HANDLE hNetlibUser;
- HANDLE hNetlibUserHttps;
+ HANDLE hNetlibUser, hNetlibUserHttps;
HANDLE hHttpsConnection;
HANDLE hMSNNudge;
+ HANDLE hPopupError, hPopupHotmail, hPopupNotify;
HANDLE hMSNAvatarsFolder;
HANDLE hCustomSmileyFolder;
|