summaryrefslogtreecommitdiff
path: root/src/modules
diff options
context:
space:
mode:
authorGeorge Hazan <george.hazan@gmail.com>2013-05-17 19:23:37 +0000
committerGeorge Hazan <george.hazan@gmail.com>2013-05-17 19:23:37 +0000
commit1d9fd398b75a5a6eca9d40db2e2abb60c96ebc7d (patch)
tree8d216553e534f6f34be4374741709aba73fc1739 /src/modules
parentc2914d5759e0ba8a3b9a81c8a1f071dba90094b4 (diff)
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
Diffstat (limited to 'src/modules')
-rw-r--r--src/modules/clist/clistmod.cpp11
1 files changed, 7 insertions, 4 deletions
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);