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/JabberG/src/jabber.h | 2 ++ protocols/JabberG/src/jabber_chat.cpp | 2 +- protocols/JabberG/src/jabber_misc.cpp | 15 +++++---------- protocols/JabberG/src/jabber_proto.cpp | 3 +++ protocols/JabberG/src/jabber_proto.h | 2 ++ 5 files changed, 13 insertions(+), 11 deletions(-) (limited to 'protocols/JabberG') 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 #include #include +#include +#include #include #include #include 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 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 -#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; -- cgit v1.2.3