diff options
author | George Hazan <george.hazan@gmail.com> | 2012-06-28 15:05:21 +0000 |
---|---|---|
committer | George Hazan <george.hazan@gmail.com> | 2012-06-28 15:05:21 +0000 |
commit | a1b54aadf426b4ce2ce3c900a889f53f1eec6bce (patch) | |
tree | 44fa2c5f6ecff873ccf332dd3bf0fd4ccff2ebe5 | |
parent | b91e3f8d37797d53b115dd5dd862953a2c595e5f (diff) |
patch for crash on exit
git-svn-id: http://svn.miranda-ng.org/main/trunk@668 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
-rw-r--r-- | plugins/Db3x/dbevents.cpp | 64 | ||||
-rw-r--r-- | plugins/Db3x/dbsettings.cpp | 11 | ||||
-rw-r--r-- | plugins/Db3x_mmap/dbevents.cpp | 67 | ||||
-rw-r--r-- | plugins/Db3x_mmap/dbsettings.cpp | 10 | ||||
-rw-r--r-- | plugins/Dbx_mmap_SA/dbsettings.cpp | 10 | ||||
-rw-r--r-- | plugins/Dbx_tree/Compatibility.cpp | 20 | ||||
-rw-r--r-- | plugins/Dbx_tree/DatabaseLink.cpp | 1 | ||||
-rw-r--r-- | plugins/Dbx_tree/Interface.h | 1 |
8 files changed, 103 insertions, 81 deletions
diff --git a/plugins/Db3x/dbevents.cpp b/plugins/Db3x/dbevents.cpp index 10d04c180e..be50babe57 100644 --- a/plugins/Db3x/dbevents.cpp +++ b/plugins/Db3x/dbevents.cpp @@ -26,45 +26,8 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. DWORD GetModuleNameOfs(const char *szName);
char *GetModuleNameByOfs(DWORD ofs);
-static INT_PTR GetEventCount(WPARAM wParam,LPARAM lParam);
-static INT_PTR AddEvent(WPARAM wParam,LPARAM lParam);
-static INT_PTR DeleteEvent(WPARAM wParam,LPARAM lParam);
-static INT_PTR GetBlobSize(WPARAM wParam,LPARAM lParam);
-static INT_PTR GetEvent(WPARAM wParam,LPARAM lParam);
-static INT_PTR MarkEventRead(WPARAM wParam,LPARAM lParam);
-static INT_PTR GetEventContact(WPARAM wParam,LPARAM lParam);
-static INT_PTR FindFirstEvent(WPARAM wParam,LPARAM lParam);
-static INT_PTR FindFirstUnreadEvent(WPARAM wParam,LPARAM lParam);
-static INT_PTR FindLastEvent(WPARAM wParam,LPARAM lParam);
-static INT_PTR FindNextEvent(WPARAM wParam,LPARAM lParam);
-static INT_PTR FindPrevEvent(WPARAM wParam,LPARAM lParam);
-
static HANDLE hEventDeletedEvent,hEventAddedEvent,hEventFilterAddedEvent;
-int InitEvents(void)
-{
- CreateServiceFunction(MS_DB_EVENT_GETCOUNT,GetEventCount);
- CreateServiceFunction(MS_DB_EVENT_ADD,AddEvent);
- CreateServiceFunction(MS_DB_EVENT_DELETE,DeleteEvent);
- CreateServiceFunction(MS_DB_EVENT_GETBLOBSIZE,GetBlobSize);
- CreateServiceFunction(MS_DB_EVENT_GET,GetEvent);
- CreateServiceFunction(MS_DB_EVENT_MARKREAD,MarkEventRead);
- CreateServiceFunction(MS_DB_EVENT_GETCONTACT,GetEventContact);
- CreateServiceFunction(MS_DB_EVENT_FINDFIRST,FindFirstEvent);
- CreateServiceFunction(MS_DB_EVENT_FINDFIRSTUNREAD,FindFirstUnreadEvent);
- CreateServiceFunction(MS_DB_EVENT_FINDLAST,FindLastEvent);
- CreateServiceFunction(MS_DB_EVENT_FINDNEXT,FindNextEvent);
- CreateServiceFunction(MS_DB_EVENT_FINDPREV,FindPrevEvent);
- hEventDeletedEvent=CreateHookableEvent(ME_DB_EVENT_DELETED);
- hEventAddedEvent=CreateHookableEvent(ME_DB_EVENT_ADDED);
- hEventFilterAddedEvent=CreateHookableEvent(ME_DB_EVENT_FILTER_ADD);
- return 0;
-}
-
-void UninitEvents(void)
-{
-}
-
static INT_PTR GetEventCount(WPARAM wParam,LPARAM lParam)
{
INT_PTR ret;
@@ -433,3 +396,30 @@ static INT_PTR FindPrevEvent(WPARAM wParam,LPARAM lParam) LeaveCriticalSection(&csDbAccess);
return ret;
}
+
+int InitEvents(void)
+{
+ CreateServiceFunction(MS_DB_EVENT_GETCOUNT,GetEventCount);
+ CreateServiceFunction(MS_DB_EVENT_ADD,AddEvent);
+ CreateServiceFunction(MS_DB_EVENT_DELETE,DeleteEvent);
+ CreateServiceFunction(MS_DB_EVENT_GETBLOBSIZE,GetBlobSize);
+ CreateServiceFunction(MS_DB_EVENT_GET,GetEvent);
+ CreateServiceFunction(MS_DB_EVENT_MARKREAD,MarkEventRead);
+ CreateServiceFunction(MS_DB_EVENT_GETCONTACT,GetEventContact);
+ CreateServiceFunction(MS_DB_EVENT_FINDFIRST,FindFirstEvent);
+ CreateServiceFunction(MS_DB_EVENT_FINDFIRSTUNREAD,FindFirstUnreadEvent);
+ CreateServiceFunction(MS_DB_EVENT_FINDLAST,FindLastEvent);
+ CreateServiceFunction(MS_DB_EVENT_FINDNEXT,FindNextEvent);
+ CreateServiceFunction(MS_DB_EVENT_FINDPREV,FindPrevEvent);
+ hEventDeletedEvent=CreateHookableEvent(ME_DB_EVENT_DELETED);
+ hEventAddedEvent=CreateHookableEvent(ME_DB_EVENT_ADDED);
+ hEventFilterAddedEvent=CreateHookableEvent(ME_DB_EVENT_FILTER_ADD);
+ return 0;
+}
+
+void UninitEvents(void)
+{
+ DestroyHookableEvent(hEventAddedEvent); hEventAddedEvent = 0;
+ DestroyHookableEvent(hEventDeletedEvent); hEventDeletedEvent = 0;
+ DestroyHookableEvent(hEventFilterAddedEvent); hEventFilterAddedEvent = 0;
+}
diff --git a/plugins/Db3x/dbsettings.cpp b/plugins/Db3x/dbsettings.cpp index ad7e470650..c8eb18c208 100644 --- a/plugins/Db3x/dbsettings.cpp +++ b/plugins/Db3x/dbsettings.cpp @@ -941,6 +941,13 @@ static int stringCompare2( DBCachedGlobalValue* p1, DBCachedGlobalValue* p2 ) return strcmp( p1->name, p2->name );
}
+static int OnPreShutdown(WPARAM, LPARAM)
+{
+ DestroyHookableEvent(hSettingChangeEvent);
+ hSettingChangeEvent = 0;
+ return 0;
+}
+
int InitSettings(void)
{
CreateServiceFunction(MS_DB_CONTACT_GETSETTING,GetContactSetting);
@@ -951,7 +958,9 @@ int InitSettings(void) CreateServiceFunction(MS_DB_CONTACT_DELETESETTING,DeleteContactSetting);
CreateServiceFunction(MS_DB_CONTACT_ENUMSETTINGS,EnumContactSettings);
CreateServiceFunction(MS_DB_SETSETTINGRESIDENT,SetSettingResident);
- hSettingChangeEvent=CreateHookableEvent(ME_DB_CONTACT_SETTINGCHANGED);
+
+ hSettingChangeEvent = CreateHookableEvent(ME_DB_CONTACT_SETTINGCHANGED);
+ HookEvent(ME_SYSTEM_PRESHUTDOWN, OnPreShutdown);
mirCp = CallService( MS_LANGPACK_GETCODEPAGE, 0, 0 );
diff --git a/plugins/Db3x_mmap/dbevents.cpp b/plugins/Db3x_mmap/dbevents.cpp index 5576455daf..76d1cd4a28 100644 --- a/plugins/Db3x_mmap/dbevents.cpp +++ b/plugins/Db3x_mmap/dbevents.cpp @@ -28,45 +28,8 @@ extern BOOL safetyMode; DWORD GetModuleNameOfs(const char *szName);
char *GetModuleNameByOfs(DWORD ofs);
-static INT_PTR GetEventCount(WPARAM wParam,LPARAM lParam);
-static INT_PTR AddEvent(WPARAM wParam,LPARAM lParam);
-static INT_PTR DeleteEvent(WPARAM wParam,LPARAM lParam);
-static INT_PTR GetBlobSize(WPARAM wParam,LPARAM lParam);
-static INT_PTR GetEvent(WPARAM wParam,LPARAM lParam);
-static INT_PTR MarkEventRead(WPARAM wParam,LPARAM lParam);
-static INT_PTR GetEventContact(WPARAM wParam,LPARAM lParam);
-static INT_PTR FindFirstEvent(WPARAM wParam,LPARAM lParam);
-static INT_PTR FindFirstUnreadEvent(WPARAM wParam,LPARAM lParam);
-static INT_PTR FindLastEvent(WPARAM wParam,LPARAM lParam);
-static INT_PTR FindNextEvent(WPARAM wParam,LPARAM lParam);
-static INT_PTR FindPrevEvent(WPARAM wParam,LPARAM lParam);
-
static HANDLE hEventDeletedEvent,hEventAddedEvent,hEventFilterAddedEvent;
-int InitEvents(void)
-{
- CreateServiceFunction(MS_DB_EVENT_GETCOUNT,GetEventCount);
- CreateServiceFunction(MS_DB_EVENT_ADD,AddEvent);
- CreateServiceFunction(MS_DB_EVENT_DELETE,DeleteEvent);
- CreateServiceFunction(MS_DB_EVENT_GETBLOBSIZE,GetBlobSize);
- CreateServiceFunction(MS_DB_EVENT_GET,GetEvent);
- CreateServiceFunction(MS_DB_EVENT_MARKREAD,MarkEventRead);
- CreateServiceFunction(MS_DB_EVENT_GETCONTACT,GetEventContact);
- CreateServiceFunction(MS_DB_EVENT_FINDFIRST,FindFirstEvent);
- CreateServiceFunction(MS_DB_EVENT_FINDFIRSTUNREAD,FindFirstUnreadEvent);
- CreateServiceFunction(MS_DB_EVENT_FINDLAST,FindLastEvent);
- CreateServiceFunction(MS_DB_EVENT_FINDNEXT,FindNextEvent);
- CreateServiceFunction(MS_DB_EVENT_FINDPREV,FindPrevEvent);
- hEventDeletedEvent=CreateHookableEvent(ME_DB_EVENT_DELETED);
- hEventAddedEvent=CreateHookableEvent(ME_DB_EVENT_ADDED);
- hEventFilterAddedEvent=CreateHookableEvent(ME_DB_EVENT_FILTER_ADD);
- return 0;
-}
-
-void UninitEvents(void)
-{
-}
-
static INT_PTR GetEventCount(WPARAM wParam,LPARAM lParam)
{
INT_PTR ret;
@@ -447,3 +410,33 @@ static INT_PTR FindPrevEvent(WPARAM wParam,LPARAM lParam) LeaveCriticalSection(&csDbAccess);
return ret;
}
+
+///////////////////////////////////////////////////////////////////////////////
+
+int InitEvents(void)
+{
+ CreateServiceFunction(MS_DB_EVENT_GETCOUNT,GetEventCount);
+ CreateServiceFunction(MS_DB_EVENT_ADD,AddEvent);
+ CreateServiceFunction(MS_DB_EVENT_DELETE,DeleteEvent);
+ CreateServiceFunction(MS_DB_EVENT_GETBLOBSIZE,GetBlobSize);
+ CreateServiceFunction(MS_DB_EVENT_GET,GetEvent);
+ CreateServiceFunction(MS_DB_EVENT_MARKREAD,MarkEventRead);
+ CreateServiceFunction(MS_DB_EVENT_GETCONTACT,GetEventContact);
+ CreateServiceFunction(MS_DB_EVENT_FINDFIRST,FindFirstEvent);
+ CreateServiceFunction(MS_DB_EVENT_FINDFIRSTUNREAD,FindFirstUnreadEvent);
+ CreateServiceFunction(MS_DB_EVENT_FINDLAST,FindLastEvent);
+ CreateServiceFunction(MS_DB_EVENT_FINDNEXT,FindNextEvent);
+ CreateServiceFunction(MS_DB_EVENT_FINDPREV,FindPrevEvent);
+
+ hEventAddedEvent = CreateHookableEvent(ME_DB_EVENT_ADDED);
+ hEventDeletedEvent = CreateHookableEvent(ME_DB_EVENT_DELETED);
+ hEventFilterAddedEvent = CreateHookableEvent(ME_DB_EVENT_FILTER_ADD);
+ return 0;
+}
+
+void UninitEvents(void)
+{
+ DestroyHookableEvent(hEventAddedEvent); hEventAddedEvent = 0;
+ DestroyHookableEvent(hEventDeletedEvent); hEventDeletedEvent = 0;
+ DestroyHookableEvent(hEventFilterAddedEvent); hEventFilterAddedEvent = 0;
+}
diff --git a/plugins/Db3x_mmap/dbsettings.cpp b/plugins/Db3x_mmap/dbsettings.cpp index 7f7687ab4c..c569357567 100644 --- a/plugins/Db3x_mmap/dbsettings.cpp +++ b/plugins/Db3x_mmap/dbsettings.cpp @@ -975,6 +975,13 @@ static int stringCompare2( char* p1, char* p2 ) return strcmp( p1, p2);
}
+static int OnPreShutdown(WPARAM, LPARAM)
+{
+ DestroyHookableEvent(hSettingChangeEvent);
+ hSettingChangeEvent = 0;
+ return 0;
+}
+
int InitSettings(void)
{
CreateServiceFunction(MS_DB_CONTACT_GETSETTING,GetContactSetting);
@@ -987,7 +994,8 @@ int InitSettings(void) CreateServiceFunction(MS_DB_SETSETTINGRESIDENT,SetSettingResident);
CreateServiceFunction("DB/ResidentSettings/Enum",EnumResidentSettings);
- hSettingChangeEvent=CreateHookableEvent(ME_DB_CONTACT_SETTINGCHANGED);
+ hSettingChangeEvent = CreateHookableEvent(ME_DB_CONTACT_SETTINGCHANGED);
+ HookEvent(ME_SYSTEM_PRESHUTDOWN, OnPreShutdown);
hCacheHeap = HeapCreate(0, 0, 0);
lSettings.sortFunc = (FSortFunc)stringCompare;
diff --git a/plugins/Dbx_mmap_SA/dbsettings.cpp b/plugins/Dbx_mmap_SA/dbsettings.cpp index d8ad0e643e..fd839ab258 100644 --- a/plugins/Dbx_mmap_SA/dbsettings.cpp +++ b/plugins/Dbx_mmap_SA/dbsettings.cpp @@ -1132,6 +1132,13 @@ static int stringCompare2( char* p1, char* p2 ) return strcmp( p1, p2);
}
+static int OnPreShutdown(WPARAM, LPARAM)
+{
+ DestroyHookableEvent(hSettingChangeEvent);
+ hSettingChangeEvent = 0;
+ return 0;
+}
+
int InitSettings(void)
{
CreateServiceFunction(MS_DB_CONTACT_GETSETTING, GetContactSetting);
@@ -1144,7 +1151,8 @@ int InitSettings(void) CreateServiceFunction(MS_DB_SETSETTINGRESIDENT, SetSettingResident);
CreateServiceFunction("DB/ResidentSettings/Enum", EnumResidentSettings);
- hSettingChangeEvent=CreateHookableEvent(ME_DB_CONTACT_SETTINGCHANGED);
+ hSettingChangeEvent = CreateHookableEvent(ME_DB_CONTACT_SETTINGCHANGED);
+ HookEvent(ME_SYSTEM_PRESHUTDOWN, OnPreShutdown);
hCacheHeap = HeapCreate(0, 0, 0);
lSettings.sortFunc = (FSortFunc)stringCompare;
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;
}
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"
|