diff options
author | George Hazan <ghazan@miranda.im> | 2020-07-22 20:47:51 +0300 |
---|---|---|
committer | George Hazan <ghazan@miranda.im> | 2020-07-22 20:47:51 +0300 |
commit | db937fbda0117e8bec530e7deda7b94eea106e78 (patch) | |
tree | 78d23a98bd3fc00117a9e34463f99e2d963b5776 /src/mir_app | |
parent | 9156c7bfb962aff2c3636907e4311a60e8c4bb34 (diff) |
to #2492: we also need to free a session when a contact gets deleted
Diffstat (limited to 'src/mir_app')
-rw-r--r-- | src/mir_app/src/chat.h | 2 | ||||
-rw-r--r-- | src/mir_app/src/chat_manager.cpp | 13 | ||||
-rw-r--r-- | src/mir_app/src/clistsettings.cpp | 2 |
3 files changed, 17 insertions, 0 deletions
diff --git a/src/mir_app/src/chat.h b/src/mir_app/src/chat.h index 81675c46ad..e3fa0461fa 100644 --- a/src/mir_app/src/chat.h +++ b/src/mir_app/src/chat.h @@ -122,6 +122,8 @@ int ShowPopup(MCONTACT hContact, SESSION_INFO *si, HICON hIcon, char* CSrmmLogWindow *Srmm_GetLogWindow(CMsgDialog *pDlg);
+void Chat_RemoveContact(MCONTACT hContact);
+
const wchar_t* my_strstri(const wchar_t* s1, const wchar_t* s2);
#pragma comment(lib,"comctl32.lib")
diff --git a/src/mir_app/src/chat_manager.cpp b/src/mir_app/src/chat_manager.cpp index 3111d6f548..8be8100efb 100644 --- a/src/mir_app/src/chat_manager.cpp +++ b/src/mir_app/src/chat_manager.cpp @@ -978,6 +978,19 @@ MIR_APP_DLL(CHAT_MANAGER*) Chat_CustomizeApi(const CHAT_MANAGER_INITDATA *pInit) /////////////////////////////////////////////////////////////////////////////////////////
+void Chat_RemoveContact(MCONTACT hContact)
+{
+ for (auto &si : g_arSessions) {
+ if (si->hContact == hContact) {
+ SM_FreeSession(si);
+ g_arSessions.removeItem(&si);
+ break;
+ }
+ }
+}
+
+/////////////////////////////////////////////////////////////////////////////////////////
+
CHAT_MANAGER::CHAT_MANAGER() :
arSessions(g_arSessions)
{
diff --git a/src/mir_app/src/clistsettings.cpp b/src/mir_app/src/clistsettings.cpp index 907a3c93b5..fe7013d852 100644 --- a/src/mir_app/src/clistsettings.cpp +++ b/src/mir_app/src/clistsettings.cpp @@ -24,6 +24,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include "stdafx.h"
#include "clc.h"
+#include "chat.h"
static LIST<ClcCacheEntry> clistCache(50, NumericKeySortT);
@@ -159,6 +160,7 @@ int ContactDeleted(WPARAM hContact, LPARAM) if (it->hContact == hContact)
g_clistApi.pfnRemoveEvent(hContact, it->hDbEvent);
+ Chat_RemoveContact(hContact);
return 0;
}
|