From a1b54aadf426b4ce2ce3c900a889f53f1eec6bce Mon Sep 17 00:00:00 2001 From: George Hazan Date: Thu, 28 Jun 2012 15:05:21 +0000 Subject: patch for crash on exit git-svn-id: http://svn.miranda-ng.org/main/trunk@668 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- plugins/Dbx_tree/Compatibility.cpp | 20 ++++++++++++++++---- plugins/Dbx_tree/DatabaseLink.cpp | 1 + plugins/Dbx_tree/Interface.h | 1 + 3 files changed, 18 insertions(+), 4 deletions(-) (limited to 'plugins/Dbx_tree') 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(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; } diff --git a/plugins/Dbx_tree/DatabaseLink.cpp b/plugins/Dbx_tree/DatabaseLink.cpp index f4bb812d0c..6af6b10503 100644 --- a/plugins/Dbx_tree/DatabaseLink.cpp +++ b/plugins/Dbx_tree/DatabaseLink.cpp @@ -139,6 +139,7 @@ Affect: Tell the database to create all services/hooks that a 3.xx legecy databa which is a PLUGINLINK structure Returns: 0 on success, nonzero on failure */ + static int Load(char* profile) { if (gDataBase) delete gDataBase; diff --git a/plugins/Dbx_tree/Interface.h b/plugins/Dbx_tree/Interface.h index 438434176a..dac5894b7d 100644 --- a/plugins/Dbx_tree/Interface.h +++ b/plugins/Dbx_tree/Interface.h @@ -30,6 +30,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include "m_plugins.h" #include "m_system.h" #include "m_utils.h" +#include "win2k.h" #include "m_langpack.h" -- cgit v1.2.3