From 071c74bd36bb49515fadb56dcae258699cf99b5d Mon Sep 17 00:00:00 2001 From: Chris Toshok Date: Thu, 15 May 2003 22:47:53 +0000 Subject: new function, split out the duplicated teardown code from final_cb and 2003-05-15 Chris Toshok * 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. svn path=/trunk/; revision=21200 --- addressbook/gui/merging/e-card-merging.c | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) (limited to 'addressbook/gui') diff --git a/addressbook/gui/merging/e-card-merging.c b/addressbook/gui/merging/e-card-merging.c index 3de0a02a6d..3577fd41b5 100644 --- a/addressbook/gui/merging/e-card-merging.c +++ b/addressbook/gui/merging/e-card-merging.c @@ -30,6 +30,15 @@ typedef struct { gpointer closure; } 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) { @@ -38,9 +47,7 @@ final_id_cb (EBook *book, EBookStatus status, const char *id, gpointer closure) 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 @@ final_cb (EBook *book, EBookStatus status, gpointer closure) 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 @@ e_card_merging_book_add_card (EBook *book, 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; -- cgit