From 81c987f5b850447389b2621037a364c3fcb0ba73 Mon Sep 17 00:00:00 2001 From: George Hazan Date: Thu, 7 May 2015 17:42:55 +0000 Subject: crash fix on exit git-svn-id: http://svn.miranda-ng.org/main/trunk@13479 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- protocols/IcqOscarJ/src/icq_rates.cpp | 4 ++++ protocols/IcqOscarJ/src/init.cpp | 9 +++++++++ protocols/IcqOscarJ/src/stdafx.h | 1 + protocols/IcqOscarJ/src/version.h | 2 +- 4 files changed, 15 insertions(+), 1 deletion(-) (limited to 'protocols') diff --git a/protocols/IcqOscarJ/src/icq_rates.cpp b/protocols/IcqOscarJ/src/icq_rates.cpp index a00db8f212..32fa47d0a1 100644 --- a/protocols/IcqOscarJ/src/icq_rates.cpp +++ b/protocols/IcqOscarJ/src/icq_rates.cpp @@ -310,6 +310,10 @@ struct rate_delay_args void __cdecl CIcqProto::rateDelayThread(rate_delay_args *pArgs) { SleepEx(pArgs->nDelay, TRUE); + + if (g_bTerminated) + return; + (pArgs->queue->*pArgs->delaycode)(); SAFE_FREE((void**)&pArgs); } diff --git a/protocols/IcqOscarJ/src/init.cpp b/protocols/IcqOscarJ/src/init.cpp index 67d5626749..d80eba68a2 100644 --- a/protocols/IcqOscarJ/src/init.cpp +++ b/protocols/IcqOscarJ/src/init.cpp @@ -32,6 +32,7 @@ HINSTANCE hInst; int hLangpack; TIME_API tmi; CLIST_INTERFACE *pcli; +bool g_bTerminated; BOOL bPopupService = FALSE; @@ -85,6 +86,12 @@ int ModuleLoad(WPARAM, LPARAM) return 0; } +static int OnPreShutdown(WPARAM, LPARAM) +{ + g_bTerminated = true; + return 0; +} + extern "C" int __declspec(dllexport) Load(void) { mir_getLP(&pluginInfo); @@ -115,6 +122,8 @@ extern "C" int __declspec(dllexport) Load(void) HookEvent(ME_SYSTEM_MODULELOAD, ModuleLoad); HookEvent(ME_SYSTEM_MODULEUNLOAD, ModuleLoad); + HookEvent(ME_SYSTEM_PRESHUTDOWN, OnPreShutdown); + hExtraXStatus = ExtraIcon_Register("xstatus", LPGEN("ICQ xStatus"), "icq_xstatus13"); g_MenuInit(); diff --git a/protocols/IcqOscarJ/src/stdafx.h b/protocols/IcqOscarJ/src/stdafx.h index bfda6d4931..d06acbb89a 100644 --- a/protocols/IcqOscarJ/src/stdafx.h +++ b/protocols/IcqOscarJ/src/stdafx.h @@ -120,3 +120,4 @@ #include "icq_proto.h" extern LIST g_Instances; +extern bool g_bTerminated; diff --git a/protocols/IcqOscarJ/src/version.h b/protocols/IcqOscarJ/src/version.h index 6826892c86..45faabfcc8 100644 --- a/protocols/IcqOscarJ/src/version.h +++ b/protocols/IcqOscarJ/src/version.h @@ -1,7 +1,7 @@ #define __MAJOR_VERSION 0 #define __MINOR_VERSION 11 #define __RELEASE_NUM 3 -#define __BUILD_NUM 2 +#define __BUILD_NUM 3 #include -- cgit v1.2.3