From 1d9fd398b75a5a6eca9d40db2e2abb60c96ebc7d Mon Sep 17 00:00:00 2001 From: George Hazan Date: Fri, 17 May 2013 19:23:37 +0000 Subject: some more fixes for MS_DB_CONTACT_DELETE & loops git-svn-id: http://svn.miranda-ng.org/main/trunk@4710 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- src/modules/clist/clistmod.cpp | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) (limited to 'src/modules') diff --git a/src/modules/clist/clistmod.cpp b/src/modules/clist/clistmod.cpp index 9ab769b65a..e25dcad0d3 100644 --- a/src/modules/clist/clistmod.cpp +++ b/src/modules/clist/clistmod.cpp @@ -143,10 +143,14 @@ static int ProtocolAck(WPARAM, LPARAM lParam) if ((int)ack->hProcess < ID_STATUS_ONLINE && ack->lParam >= ID_STATUS_ONLINE) { DWORD caps = (DWORD)CallProtoServiceInt(NULL,ack->szModule, PS_GETCAPS, PFLAGNUM_1, 0); - if (caps & PF1_SERVERCLIST) - for (HANDLE hContact = db_find_first(ack->szModule); hContact; hContact = db_find_next(hContact, ack->szModule)) + if (caps & PF1_SERVERCLIST) { + for (HANDLE hContact = db_find_first(ack->szModule); hContact; ) { + HANDLE hNext = db_find_next(hContact, ack->szModule); if (db_get_b(hContact, "CList", "Delete", 0)) CallService(MS_DB_CONTACT_DELETE, (WPARAM)hContact, 0); + hContact = hNext; + } + } } cli.pfnTrayIconUpdateBase(ack->szModule); @@ -544,8 +548,7 @@ void UnloadContactListModule() return; //remove transitory contacts - HANDLE hContact = db_find_first(); - while (hContact != NULL) { + for (HANDLE hContact = db_find_first(); hContact != NULL; ) { HANDLE hNext = db_find_next(hContact); if (db_get_b(hContact, "CList", "NotOnList", 0)) CallService(MS_DB_CONTACT_DELETE, (WPARAM) hContact, 0); -- cgit v1.2.3