[evolution-patches] patch for addressbook #43016



we need to keep a reference to the card throughout the async merging
code.

Chris
Index: ChangeLog
===================================================================
RCS file: /cvs/gnome/evolution/addressbook/ChangeLog,v
retrieving revision 1.1407
diff -u -r1.1407 ChangeLog
--- ChangeLog	14 May 2003 22:00:43 -0000	1.1407
+++ ChangeLog	15 May 2003 00:17:14 -0000
@@ -1,5 +1,14 @@
 2003-05-14  Chris Toshok  <toshok ximian com>
 
+	* gui/merging/e-card-merging.c (free_lookup): new function, split
+	out the duplicated teardown code from final_cb and final_id_cb.
+	also, unref the card.
+	(final_id_cb): call free_lookup.
+	(final_cb): same.
+	(e_card_merging_book_add_card): ref the card.  fixes bug #43016.
+
+2003-05-14  Chris Toshok  <toshok ximian com>
+
 	* gui/contact-editor/e-contact-editor.c (full_addr_clicked):
 	replace the text_buffer_delete/text_buffer_insert with
 	set_buffer_set_text.  call widget_changed if they clicked OK, so
Index: gui/merging/e-card-merging.c
===================================================================
RCS file: /cvs/gnome/evolution/addressbook/gui/merging/e-card-merging.c,v
retrieving revision 1.10
diff -u -r1.10 e-card-merging.c
--- gui/merging/e-card-merging.c	3 Apr 2003 22:34:54 -0000	1.10
+++ gui/merging/e-card-merging.c	15 May 2003 00:17:14 -0000
@@ -31,6 +31,15 @@
 } ECardMergingLookup;
 
 static void
+free_lookup (ECardMergingLookup *lookup)
+{
+	g_object_unref (lookup->book);
+	g_object_unref (lookup->card);
+
+	g_free (lookup);
+}
+
+static void
 final_id_cb (EBook *book, EBookStatus status, const char *id, gpointer closure)
 {
 	ECardMergingLookup *lookup = closure;
@@ -38,9 +47,7 @@
 	if (lookup->id_cb)
 		lookup->id_cb (lookup->book, status, id, lookup->closure);
 
-	g_object_unref (lookup->book);
-
-	g_free (lookup);
+	free_lookup (lookup);
 }
 
 static void
@@ -51,9 +58,7 @@
 	if (lookup->cb)
 		lookup->cb (lookup->book, status, lookup->closure);
 
-	g_object_unref (lookup->book);
-
-	g_free (lookup);
+	free_lookup (lookup);
 }
 
 static void
@@ -144,7 +149,7 @@
 
 	lookup->op = E_CARD_MERGING_ADD;
 	lookup->book = g_object_ref (book);
-	lookup->card = card;
+	lookup->card = g_object_ref (card);
 	lookup->id_cb = cb;
 	lookup->closure = closure;
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]