summaryrefslogtreecommitdiff
path: root/protocols/JabberG/src
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 /protocols/JabberG/src
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 'protocols/JabberG/src')
-rw-r--r--protocols/JabberG/src/jabber.h2
-rw-r--r--protocols/JabberG/src/jabber_chat.cpp2
-rw-r--r--protocols/JabberG/src/jabber_misc.cpp15
-rw-r--r--protocols/JabberG/src/jabber_proto.cpp3
-rw-r--r--protocols/JabberG/src/jabber_proto.h2
5 files changed, 13 insertions, 11 deletions
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;