summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorGeorge Hazan <george.hazan@gmail.com>2014-03-15 11:51:03 +0000
committerGeorge Hazan <george.hazan@gmail.com>2014-03-15 11:51:03 +0000
commit2bc82e6bbe6141a102c20cd65bfcfb11ea80f303 (patch)
tree41da5738bedefa0deabb68ee057da5368e93630f /src
parentf2ad1e8120741aee13b03071fc01be975db994e3 (diff)
crash fix
git-svn-id: http://svn.miranda-ng.org/main/trunk@8621 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'src')
-rw-r--r--src/modules/protocols/protoaccs.cpp14
-rw-r--r--src/modules/protocols/protocols.cpp2
2 files changed, 12 insertions, 4 deletions
diff --git a/src/modules/protocols/protoaccs.cpp b/src/modules/protocols/protoaccs.cpp
index 183e72b0f8..9fd416ad78 100644
--- a/src/modules/protocols/protoaccs.cpp
+++ b/src/modules/protocols/protoaccs.cpp
@@ -32,6 +32,7 @@ void BuildProtoMenus();
HICON Proto_GetIcon(PROTO_INTERFACE *ppro, int iconIndex);
static BOOL bModuleInitialized = FALSE;
+static HANDLE hHooks[4];
static int CompareAccounts(const PROTOACCOUNT* p1, const PROTOACCOUNT* p2)
{
@@ -199,6 +200,7 @@ void WriteDbAccounts()
}
/////////////////////////////////////////////////////////////////////////////////////////
+
static int OnContactDeleted(WPARAM hContact, LPARAM lParam)
{
if (hContact) {
@@ -275,10 +277,10 @@ int LoadAccountsModule(void)
pa->bDynDisabled = TRUE;
}
- HookEvent(ME_SYSTEM_MODULESLOADED, InitializeStaticAccounts);
- HookEvent(ME_SYSTEM_PRESHUTDOWN, UninitializeStaticAccounts);
- HookEvent(ME_DB_CONTACT_DELETED, OnContactDeleted);
- HookEvent(ME_DB_CONTACT_SETTINGCHANGED, OnDbSettingsChanged);
+ hHooks[0] = HookEvent(ME_SYSTEM_MODULESLOADED, InitializeStaticAccounts);
+ hHooks[1] = HookEvent(ME_SYSTEM_PRESHUTDOWN, UninitializeStaticAccounts);
+ hHooks[2] = HookEvent(ME_DB_CONTACT_DELETED, OnContactDeleted);
+ hHooks[3] = HookEvent(ME_DB_CONTACT_SETTINGCHANGED, OnDbSettingsChanged);
return 0;
}
@@ -582,6 +584,10 @@ void UnloadAccountsModule()
UnloadAccount(pa, false, false);
accounts.remove(i);
}
+ accounts.destroy();
+
+ for (int i = 0; i < SIZEOF(hHooks); i++)
+ UnhookEvent(hHooks[i]);
}
/////////////////////////////////////////////////////////////////////////////////////////
diff --git a/src/modules/protocols/protocols.cpp b/src/modules/protocols/protocols.cpp
index ed56413f0a..6d57eb10e9 100644
--- a/src/modules/protocols/protocols.cpp
+++ b/src/modules/protocols/protocols.cpp
@@ -704,10 +704,12 @@ void UnloadProtocolsModule()
mir_free(protos[i]->szName);
mir_free(protos[i]);
}
+ protos.destroy();
}
for (int i=0; i < serviceItems.getCount(); i++)
mir_free(serviceItems[i]);
+ serviceItems.destroy();
}
/////////////////////////////////////////////////////////////////////////////////////////