diff options
author | George Hazan <ghazan@miranda.im> | 2018-10-31 16:38:00 +0300 |
---|---|---|
committer | George Hazan <ghazan@miranda.im> | 2018-10-31 16:38:00 +0300 |
commit | 5cc9245a01e968e8c6fbc801b46a489e7abbac15 (patch) | |
tree | 107e8ecc4ab141cd9df4ddc9e7c922dfc742116f | |
parent | 67a6c03577c66cb1b8cb69ad1f31b79fa7cc8a3c (diff) |
more intelligent implementation of MM_RemoveAll()
-rw-r--r-- | src/mir_app/src/chat_manager.cpp | 21 |
1 files changed, 10 insertions, 11 deletions
diff --git a/src/mir_app/src/chat_manager.cpp b/src/mir_app/src/chat_manager.cpp index b3b70ede3f..1f2053110b 100644 --- a/src/mir_app/src/chat_manager.cpp +++ b/src/mir_app/src/chat_manager.cpp @@ -46,7 +46,7 @@ static int compareModules(const MODULEINFO *p1, const MODULEINFO *p2) return mir_strcmp(p1->pszModule, p2->pszModule);
}
-LIST<MODULEINFO> g_arModules(5, compareModules);
+static OBJLIST<MODULEINFO> g_arModules(5, compareModules);
/////////////////////////////////////////////////////////////////////////////////////////
@@ -508,7 +508,14 @@ GCModuleInfoBase::GCModuleInfoBase() {}
GCModuleInfoBase::~GCModuleInfoBase()
-{}
+{
+ if (g_chatApi.OnDestroyModule)
+ g_chatApi.OnDestroyModule((MODULEINFO*)this);
+
+ mir_free(pszModule);
+ mir_free(ptszModDispName);
+ mir_free(pszHeader);
+}
MODULEINFO* MM_AddModule(const char *pszModule)
{
@@ -559,15 +566,7 @@ MODULEINFO* MM_FindModule(const char *pszModule) static BOOL MM_RemoveAll(void)
{
- for (auto &mi : g_arModules) {
- if (g_chatApi.OnDestroyModule)
- g_chatApi.OnDestroyModule(mi);
-
- mir_free(mi->pszModule);
- mir_free(mi->ptszModDispName);
- mir_free(mi->pszHeader);
- delete mi;
- }
+ g_arModules.destroy();
return TRUE;
}
|