diff options
author | Chris Toshok <toshok@ximian.com> | 2003-05-16 06:47:53 +0800 |
---|---|---|
committer | Chris Toshok <toshok@src.gnome.org> | 2003-05-16 06:47:53 +0800 |
commit | 071c74bd36bb49515fadb56dcae258699cf99b5d (patch) | |
tree | 550aa2da68e67078a0d6a742a22517d6f6fb5f30 /addressbook/gui | |
parent | 522e7942df3fe517168895421812e67158c53090 (diff) | |
download | gsoc2013-evolution-071c74bd36bb49515fadb56dcae258699cf99b5d.tar.gz gsoc2013-evolution-071c74bd36bb49515fadb56dcae258699cf99b5d.tar.zst gsoc2013-evolution-071c74bd36bb49515fadb56dcae258699cf99b5d.zip |
new function, split out the duplicated teardown code from final_cb and
2003-05-15 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.
svn path=/trunk/; revision=21200
Diffstat (limited to 'addressbook/gui')
-rw-r--r-- | addressbook/gui/merging/e-card-merging.c | 19 |
1 files changed, 12 insertions, 7 deletions
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 @@ -31,6 +31,15 @@ typedef struct { } 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 @@ 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; |