From 3ed57b9844b340d1732d85d76f2184498aba5609 Mon Sep 17 00:00:00 2001 From: George Hazan Date: Tue, 27 Mar 2018 20:51:02 +0300 Subject: crash fix for Jabber --- protocols/JabberG/src/jabber.cpp | 1 + protocols/JabberG/src/jabber_icolib.cpp | 2 +- protocols/JabberG/src/jabber_icolib.h | 10 +++++++--- protocols/JabberG/src/jabber_xstatus.cpp | 6 ++++++ protocols/JabberG/src/stdafx.h | 1 + 5 files changed, 16 insertions(+), 4 deletions(-) (limited to 'protocols/JabberG') diff --git a/protocols/JabberG/src/jabber.cpp b/protocols/JabberG/src/jabber.cpp index ffeb046594..c6046e2b2e 100755 --- a/protocols/JabberG/src/jabber.cpp +++ b/protocols/JabberG/src/jabber.cpp @@ -222,6 +222,7 @@ extern "C" int __declspec(dllexport) Load() extern "C" int __declspec(dllexport) Unload(void) { + g_XstatusIconsUninit(); JabberUserInfoUninit(); if (hMsftedit != nullptr) diff --git a/protocols/JabberG/src/jabber_icolib.cpp b/protocols/JabberG/src/jabber_icolib.cpp index 1e8bfa7b07..36302d1d3f 100644 --- a/protocols/JabberG/src/jabber_icolib.cpp +++ b/protocols/JabberG/src/jabber_icolib.cpp @@ -98,7 +98,7 @@ CIconPool::CPoolItem::~CPoolItem() mir_free(m_szIcolibName); } - if (m_name) mir_free(m_name); + mir_free(m_name); } CIconPool::CIconPool() : diff --git a/protocols/JabberG/src/jabber_icolib.h b/protocols/JabberG/src/jabber_icolib.h index d30c0ea62a..e272cd7493 100644 --- a/protocols/JabberG/src/jabber_icolib.h +++ b/protocols/JabberG/src/jabber_icolib.h @@ -38,8 +38,12 @@ public: void RegisterIcon(const char *name, wchar_t *filename, int iconid, wchar_t *szSection, wchar_t *szDescription); HANDLE GetIcolibHandle(const char *name); - char *GetIcolibName(const char *name); - HICON GetIcon(const char *name, bool big = false); + char* GetIcolibName(const char *name); + HICON GetIcon(const char *name, bool big = false); + + __forceinline void Clear() + { m_items.destroy(); + } private: struct CPoolItem @@ -56,7 +60,7 @@ private: OBJLIST m_items; - CPoolItem *FindItemByName(const char *name); + CPoolItem* FindItemByName(const char *name); }; #endif // _JABBER_ICOLIB_H_ diff --git a/protocols/JabberG/src/jabber_xstatus.cpp b/protocols/JabberG/src/jabber_xstatus.cpp index 09de8a92b6..06666c36fd 100644 --- a/protocols/JabberG/src/jabber_xstatus.cpp +++ b/protocols/JabberG/src/jabber_xstatus.cpp @@ -1524,3 +1524,9 @@ void g_XstatusIconsInit() g_ActivityIcons.RegisterIcon(g_arrActivities[k].szSecond, szFile, g_arrActivities[k].iconid, szSection, TranslateW(g_arrActivities[k].szTitle)); } } + +void g_XstatusIconsUninit() +{ + g_MoodIcons.Clear(); + g_ActivityIcons.Clear(); +} diff --git a/protocols/JabberG/src/stdafx.h b/protocols/JabberG/src/stdafx.h index 6943d549e0..ca39578fe3 100644 --- a/protocols/JabberG/src/stdafx.h +++ b/protocols/JabberG/src/stdafx.h @@ -640,6 +640,7 @@ HXML JabberFormGetData(HWND hwndStatic, HXML xNode); void g_IconsInit(); void g_XstatusIconsInit(); +void g_XstatusIconsUninit(); HANDLE g_GetIconHandle(int iconId); HICON g_LoadIconEx(const char* name, bool big = false); -- cgit v1.2.3