summaryrefslogtreecommitdiff
path: root/plugins/Dbx_tree/Compatibility.cpp
diff options
context:
space:
mode:
authorGeorge Hazan <george.hazan@gmail.com>2012-06-28 15:05:21 +0000
committerGeorge Hazan <george.hazan@gmail.com>2012-06-28 15:05:21 +0000
commita1b54aadf426b4ce2ce3c900a889f53f1eec6bce (patch)
tree44fa2c5f6ecff873ccf332dd3bf0fd4ccff2ebe5 /plugins/Dbx_tree/Compatibility.cpp
parentb91e3f8d37797d53b115dd5dd862953a2c595e5f (diff)
patch for crash on exit
git-svn-id: http://svn.miranda-ng.org/main/trunk@668 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins/Dbx_tree/Compatibility.cpp')
-rw-r--r--plugins/Dbx_tree/Compatibility.cpp20
1 files changed, 16 insertions, 4 deletions
diff --git a/plugins/Dbx_tree/Compatibility.cpp b/plugins/Dbx_tree/Compatibility.cpp
index 38b8f92383..e0c34c8feb 100644
--- a/plugins/Dbx_tree/Compatibility.cpp
+++ b/plugins/Dbx_tree/Compatibility.cpp
@@ -807,8 +807,21 @@ INT_PTR CompGetProfilePath(WPARAM cbBytes, LPARAM pszName)
return gDataBase->getProfilePath(cbBytes, reinterpret_cast<char*>(pszName));
}
+int OnPreShutdown(WPARAM, LPARAM)
+{
+ DestroyHookableEvent(hEventDeletedEvent);
+ DestroyHookableEvent(hEventAddedEvent);
+ DestroyHookableEvent(hEventFilterAddedEvent);
+ DestroyHookableEvent(hSettingChangeEvent);
+ DestroyHookableEvent(hContactDeletedEvent);
+ DestroyHookableEvent(hContactAddedEvent);
+ return 0;
+}
+
bool CompatibilityRegister()
{
+ HookEvent(ME_SYSTEM_PRESHUTDOWN, OnPreShutdown);
+
gCompServices[ 0] = CreateServiceFunction(MS_DB_CONTACT_GETCOUNT, CompGetContactCount);
gCompServices[ 1] = CreateServiceFunction(MS_DB_CONTACT_FINDFIRST, CompFindFirstContact);
gCompServices[ 2] = CreateServiceFunction(MS_DB_CONTACT_FINDNEXT, CompFindNextContact);
@@ -855,12 +868,11 @@ bool CompatibilityRegister()
hContactAddedEvent = CreateHookableEvent(ME_DB_CONTACT_ADDED);
return true;
}
+
bool CompatibilityUnRegister()
{
- int i;
- for (i = 0; i < sizeof(gCompServices) / sizeof(gCompServices[0]); ++i)
- {
+ for (int i = 0; i < SIZEOF(gCompServices); ++i)
DestroyServiceFunction(gCompServices[i]);
- }
+
return true;
}