From 87cae0ab16baff67784eabfa41464bb598204b13 Mon Sep 17 00:00:00 2001 From: George Hazan Date: Sat, 4 Oct 2014 13:58:06 +0000 Subject: fix for the EV_PROTO_ONREADYTOEXIT processing git-svn-id: http://svn.miranda-ng.org/main/trunk@10686 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- src/modules/protocols/protoaccs.cpp | 23 +++++++++++++++++------ 1 file changed, 17 insertions(+), 6 deletions(-) (limited to 'src/modules') 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); } -- cgit v1.2.3