Sorry, this mail was send to the wrong thread, pls remove the original one if possible, thanks.

I have 411 records on my palm, database of evolution has just been cleaned up, every time I use Resync to copy all the palm records to evolution, some records will be lost, the number of missing records is randomly, maybe 4 or 10 and even more.
tried the lastest branch_08X cvs version, the same problem.

After some days tracing, the following is the tracing results

--- ---------------------------------------------------------------
--- evo_addr_seqcompl_cb enter, addr_mode=EVO_ADDR_MODE_MODIFIED
--- evo_addr_modify_next enter, conn->modify_no=3
--- evo_addr_modify_next obj->change_type=SYNC_OBJ_ADDED
--- evo_addr_modify_next call e_book_add_vcard, conn->modify_no=4
--- evo_addr_modify_next call e_book_add_vcard finish
--- evo_addr_modify_next leave
--- evo_addr_seqcompl_cb leave
--- evo_addr_seqcompl_cb enter, addr_mode=EVO_ADDR_MODE_GOT_CHANGE
--- evo_addr_seqcompl_cb leave
--- evo_addr_seqcompl_cb enter, addr_mode=EVO_ADDR_MODE_GOT_CHANGE
--- evo_addr_seqcompl_cb leave
--- evo_addr_change enter, change_type=SYNC_OBJ_ADDED addr_mode=EVO_ADDR_MODE_MODIFIED
--- evo_addr_change leave
--- evo_addr_change enter, change_type=SYNC_OBJ_ADDED addr_mode=EVO_ADDR_MODE_WAITING
--- evo_addr_change leave
--- evo_addr_change enter, change_type=SYNC_OBJ_ADDED addr_mode=EVO_ADDR_MODE_WAITING
--- evo_addr_change leave
--- evo_addr_add_cb enter, conn->modify_no=4
--- evo_addr_add_cb leave

>>> above tracing records are right, but the following records seems strange,
>>> the callback function evo_addr_seqcompl_cb of next record was called before evo_addr_add_cb
--- ---------------------------------------------------------------
--- evo_addr_seqcompl_cb enter, addr_mode=EVO_ADDR_MODE_MODIFIED
--- evo_addr_modify_next enter, conn->modify_no=4
--- evo_addr_modify_next obj->change_type=SYNC_OBJ_ADDED
--- evo_addr_modify_next call e_book_add_vcard, conn->modify_no=5
--- evo_addr_modify_next call e_book_add_vcard finish
--- evo_addr_modify_next leave
--- evo_addr_seqcompl_cb leave
--- evo_addr_seqcompl_cb enter, addr_mode=EVO_ADDR_MODE_GOT_CHANGE
--- evo_addr_seqcompl_cb leave
--- evo_addr_seqcompl_cb enter, addr_mode=EVO_ADDR_MODE_GOT_CHANGE
--- evo_addr_seqcompl_cb leave
--- evo_addr_change enter, change_type=SYNC_OBJ_ADDED addr_mode=EVO_ADDR_MODE_MODIFIED
--- evo_addr_change leave
--- evo_addr_change enter, change_type=SYNC_OBJ_ADDED addr_mode=EVO_ADDR_MODE_WAITING
--- evo_addr_change leave
--- evo_addr_change enter, change_type=SYNC_OBJ_ADDED addr_mode=EVO_ADDR_MODE_WAITING
--- evo_addr_change leave
--- ---------------------------------------------------------------
--- evo_addr_seqcompl_cb enter, addr_mode=EVO_ADDR_MODE_MODIFIED
--- evo_addr_modify_next enter, conn->modify_no=5
--- evo_addr_modify_next obj->change_type=SYNC_OBJ_ADDED
--- evo_addr_modify_next call e_book_add_vcard, conn->modify_no=6
--- evo_addr_modify_next call e_book_add_vcard finish
--- evo_addr_modify_next leave
--- evo_addr_seqcompl_cb leave
--- evo_addr_seqcompl_cb enter, addr_mode=EVO_ADDR_MODE_GOT_CHANGE
--- evo_addr_seqcompl_cb leave
--- evo_addr_seqcompl_cb enter, addr_mode=EVO_ADDR_MODE_GOT_CHANGE
--- evo_addr_seqcompl_cb leave
--- evo_addr_add_cb enter, conn->modify_no=6
--- evo_addr_add_cb leave
--- evo_addr_change enter, change_type=SYNC_OBJ_ADDED addr_mode=EVO_ADDR_MODE_MODIFIED
--- evo_addr_change leave
--- evo_addr_change enter, change_type=SYNC_OBJ_ADDED addr_mode=EVO_ADDR_MODE_WAITING
--- evo_addr_change leave
--- evo_addr_change enter, change_type=SYNC_OBJ_ADDED addr_mode=EVO_ADDR_MODE_WAITING
--- evo_addr_change leave
--- evo_addr_add_cb enter, conn->modify_no=6
--- evo_addr_add_cb result->returnuid != NULL
--- evo_addr_add_cb leave

seems that the function e_book_add_vcard will accumulate the call to evo_addr_add_cb.
any ideas ?

I made a patch to resolve this problem temporary:
diff -u multisync-0.82/plugins/evolution_sync/src/addr_sync.c multisync-0.82.debug/plugins/evolution_sync/src/addr_sync.c
--- multisync-0.82/plugins/evolution_sync/src/addr_sync.c 2004-04-13 05:03:03.000000000 +0800
+++ multisync-0.82.debug/plugins/evolution_sync/src/addr_sync.c 2004-08-12 22:46:45.000000000 +0800
@@ -34,6 +34,12 @@

extern gboolean multisync_debug;

+typedef struct
+{
+  syncobj_modify_result *result;
+  evolution_connection *conn;
+} modify_result_t;
+
// Returns the UID of a vcard as a g_malloced string.
char* evo_addr_get_uid(char *vcard) {
   char *pos = vcard;
@@ -272,10 +278,10 @@

void evo_addr_add_cb (EBook *book, EBookStatus status, const char *id,
      gpointer data) {
-  evolution_connection *conn = data;
+  modify_result_t* modify_result = data;
+
   if (status == E_BOOK_STATUS_SUCCESS) {
-    syncobj_modify_result *result = g_list_nth_data(conn->modify_results,
-     conn->modify_no);
+    syncobj_modify_result *result = modify_result->result;
     if (result) {
       if (result->returnuid)
g_free(result->returnuid);
@@ -283,8 +289,9 @@
       result->result = SYNC_MSG_REQDONE;
     }
   } else {
-    evo_addr_modify_next(conn, FALSE);
+    evo_addr_modify_next(modify_result->conn, FALSE);
   }
+  g_free (modify_result);
}


@@ -391,7 +398,11 @@
       g_free(tmp);
       conn->addr_mode = EVO_ADDR_MODE_MODIFIED;
       if (!obj->uid || tryadd) { // Add new card
- e_book_add_vcard (conn->ebook, newcard, evo_addr_add_cb, conn);
+ modify_result_t* modify_result = g_malloc (sizeof (modify_result_t));
+ modify_result->result = g_list_nth_data(conn->modify_results,
+     conn->modify_no);
+ modify_result->conn = conn;
+ e_book_add_vcard (conn->ebook, newcard, evo_addr_add_cb, modify_result);
       } else { // Modify a card
e_book_commit_vcard (conn->ebook, newcard, evo_addr_modify_cb, conn);
       }
evolution plugin lost records occasionallyevolution plugin lost records occasionally

Reply via email to