From 9bcf384669cc213c80e35c6d4f48969ce17d4676 Mon Sep 17 00:00:00 2001 From: Gluzskiy Alexandr Date: Sat, 3 Jul 2010 19:30:19 +0300 Subject: fixed cleaning dynamic list of temporary users --- utilities.cpp | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) (limited to 'utilities.cpp') diff --git a/utilities.cpp b/utilities.cpp index 7f59ce4..90f8a7e 100644 --- a/utilities.cpp +++ b/utilities.cpp @@ -74,9 +74,10 @@ struct hContact_entry void RemoveExcludedUsers() { HANDLE hContact; - hContact_entry first, *plist, *tmp; + hContact_entry *first, *plist, *tmp; hContact = (HANDLE)CallService(MS_DB_CONTACT_FINDFIRST, 0, 0); - plist = &first; + first = new hContact_entry; + plist = first; plist->hContact = INVALID_HANDLE_VALUE; if(hContact) { @@ -92,13 +93,13 @@ void RemoveExcludedUsers() } while(hContact = (HANDLE)CallService(MS_DB_CONTACT_FINDNEXT,(WPARAM)hContact, 0)) ; - plist = &first; + plist = first; while(plist->hContact != INVALID_HANDLE_VALUE) { CallService(MS_DB_CONTACT_DELETE, (WPARAM)plist->hContact, 0); tmp = plist; plist = plist->next; -// delete tmp; //something wrong here %) + delete tmp; } } } @@ -106,9 +107,10 @@ void RemoveExcludedUsers() void RemoveTemporaryUsers() { HANDLE hContact; - hContact_entry first, *plist, *tmp; + hContact_entry *first, *plist, *tmp; hContact = (HANDLE)CallService(MS_DB_CONTACT_FINDFIRST, 0, 0); - plist = &first; + first = new hContact_entry; + plist = first; plist->hContact = INVALID_HANDLE_VALUE; if(hContact) { @@ -124,13 +126,13 @@ void RemoveTemporaryUsers() } while(hContact = (HANDLE)CallService(MS_DB_CONTACT_FINDNEXT,(WPARAM)hContact, 0)) ; - plist = &first; + plist = first; while(plist->hContact != INVALID_HANDLE_VALUE) { CallService(MS_DB_CONTACT_DELETE, (WPARAM)plist->hContact, 0); tmp = plist; plist = plist->next; -// delete tmp; //something wrong here %) + delete tmp; } } } -- cgit v1.2.3