summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorGeorge Hazan <george.hazan@gmail.com>2014-10-04 13:58:06 +0000
committerGeorge Hazan <george.hazan@gmail.com>2014-10-04 13:58:06 +0000
commit87cae0ab16baff67784eabfa41464bb598204b13 (patch)
tree9849bd2ff46bd023b9f2353b9f7bfb7983496a99 /src
parent919a523bda8412c60a70a0482f4d741db6fd7d69 (diff)
fix for the EV_PROTO_ONREADYTOEXIT processing
git-svn-id: http://svn.miranda-ng.org/main/trunk@10686 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'src')
-rw-r--r--src/modules/protocols/protoaccs.cpp23
1 files changed, 17 insertions, 6 deletions
diff --git a/src/modules/protocols/protoaccs.cpp b/src/modules/protocols/protoaccs.cpp
index 9f7dc933ee..65e948393d 100644
--- a/src/modules/protocols/protoaccs.cpp
+++ b/src/modules/protocols/protoaccs.cpp
@@ -249,13 +249,21 @@ static int InitializeStaticAccounts(WPARAM, LPARAM)
static int UninitializeStaticAccounts(WPARAM, LPARAM)
{
- for (int i=0; i < accounts.getCount(); i++) {
+ for (int i = 0; i < accounts.getCount(); i++) {
PROTOACCOUNT *pa = accounts[i];
- if (!pa->ppro || !Proto_IsAccountEnabled(pa))
- continue;
+ if (pa->ppro && Proto_IsAccountEnabled(pa))
+ if (pa->ppro->OnEvent(EV_PROTO_ONREADYTOEXIT, 0, 0) != 0)
+ return 1;
+ }
+ return 0;
+}
- pa->ppro->OnEvent(EV_PROTO_ONREADYTOEXIT, 0, 0);
- pa->ppro->OnEvent(EV_PROTO_ONEXIT, 0, 0);
+static int ShutdownStaticAccounts(WPARAM, LPARAM)
+{
+ for (int i = 0; i < accounts.getCount(); i++) {
+ PROTOACCOUNT *pa = accounts[i];
+ if (pa->ppro && Proto_IsAccountEnabled(pa))
+ pa->ppro->OnEvent(EV_PROTO_ONEXIT, 0, 0);
}
return 0;
}
@@ -279,6 +287,7 @@ int LoadAccountsModule(void)
hHooks[0] = HookEvent(ME_SYSTEM_MODULESLOADED, InitializeStaticAccounts);
hHooks[1] = HookEvent(ME_SYSTEM_PRESHUTDOWN, UninitializeStaticAccounts);
+ hHooks[1] = HookEvent(ME_SYSTEM_SHUTDOWN, ShutdownStaticAccounts);
hHooks[2] = HookEvent(ME_DB_CONTACT_DELETED, OnContactDeleted);
hHooks[3] = HookEvent(ME_DB_CONTACT_SETTINGCHANGED, OnDbSettingsChanged);
return 0;
@@ -491,7 +500,9 @@ static int DeactivationThread(DeactivationThreadParam* param)
char *szModuleName = NEWSTR_ALLOCA(p->m_szModuleName);
if (param->bIsDynamic) {
- p->OnEvent(EV_PROTO_ONREADYTOEXIT, 0, 0);
+ while (p->OnEvent(EV_PROTO_ONREADYTOEXIT, 0, 0) != 0)
+ SleepEx(100, TRUE);
+
p->OnEvent(EV_PROTO_ONEXIT, 0, 0);
}