Moin,

situation:
Syning KDE Addressbook (3.3 on KDE 3.3.0) with backup-plugin
works. Now delete one entry in Addressbook, sync again.
You get a SEGV:

kdepim_plugin: KDE addressbook locked OK.
kaddrbook.cpp: get_changes : plugin UID list has 3 entries
kdepim_plugin: DELETED  UID=WWFke48vIq

Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread 1118796720 (LWP 7598)]
0x422e8209 in ucstrcmp () from /usr/lib/qt3/lib/libqt-mt.so.3
(gdb) bt
#0  0x422e8209 in ucstrcmp () from /usr/lib/qt3/lib/libqt-mt.so.3
#1  0x422ea7e1 in operator< () from /usr/lib/qt3/lib/libqt-mt.so.3
#2  0x4136e23a in QMapPrivate<QString, KABC::Addressee>::find () from 
/opt/kde3/lib/libkabc.so.1
#3  0x41339578 in KABC::Resource::findByUid () from /opt/kde3/lib/libkabc.so.1
#4  0x41341d84 in KABC::AddressBook::findByUid () from /opt/kde3/lib/libkabc.so.
1
#5  0x4128aad6 in kaddrbook::get_changes (this=0x8236fc8, listptr=0x82baed0, newdbs=0)
    at kaddrbook.cpp:283
#6  0x41289d62 in kaddrbook_get_changes (pkaddrbook=0x8236fc8, listptr=0x82baed0 , 
newdbs=0)
        at kaddrbook.cpp:509
#7  0x4128be1f in get_changes (conn=0x80b2508, newdbs=SYNC_OBJECT_TYPE_UNKNOWN) 
        at kdeplugin.c:93


I've appended a patch which fixes this. 
(Short summary: removing uid from list with
uidlist.remove(it)  in kaddrbook.cpp:307  returns the new iterator it, not
taking this into account corrupts iterator as it seems)

I don't know if older KDE-versions also have this problem.

        Please verify and apply.

                ciao,
                  Stefan

-- 
Stefan Behlert
--- multisync-cvs-dev-snapshot-20041103.orig/plugins/kdepim_plugin/src/kaddrbook.cpp   
 2004-07-10 09:49:15.000000000 +0200
+++ multisync-cvs-dev-snapshot-20041103/plugins/kdepim_plugin/src/kaddrbook.cpp 
2004-11-04 11:57:41.000000000 +0100
@@ -275,14 +275,17 @@
 
             //Now find any UIDs in the old list that are missing from the KDE 
addressbook,
             //these are records that have been deleted.
-            for (QStringList::Iterator it=uidlist.begin(); it!=uidlist.end(); it++)
+            for (QStringList::Iterator it=uidlist.begin(); it!=uidlist.end(); )
                 {
                 //Find matching record in KDE Addressbook.
                 //If not found then we have detected an entry that had been deleted 
from the KDE
                 //adressbook since the last syunchronisation.
                 KABC::Addressee addressee = addressbookptr->findByUid(*it);
                 if (!addressee.isEmpty())
+                   {
+                   i++;
                     continue;
+                   }
 
                 //this prevUID is missing from currUID, it represents a DELETED entry
                 if (multisync_debug)
@@ -304,7 +307,7 @@
                 list = g_list_append(list,chobj);                        
 
                 //Remove the corresponding UID from our own UID list
-                uidlist.remove(it);
+                it=uidlist.remove(it);
                 }
 
             //update caller's listptr and return success

Reply via email to