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/Db3x/dbevents.cpp | 64 ++++++++++++++++++++--------------------------- 1 file changed, 27 insertions(+), 37 deletions(-) (limited to 'plugins/Db3x/dbevents.cpp') 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; +} -- cgit v1.2.3