diff options
author | Radek Doulik <rodo@ximian.com> | 2001-08-07 00:01:33 +0800 |
---|---|---|
committer | Radek Doulik <rodo@src.gnome.org> | 2001-08-07 00:01:33 +0800 |
commit | 3bc3e77da731d78970aae36510c421050d1182fb (patch) | |
tree | e088329e827504b2710d336c507279f48d434229 /addressbook/backend/ebook/e-book.c | |
parent | f29e762e0bc379caef1a2899d7d8bd43c2d45228 (diff) | |
download | gsoc2013-evolution-3bc3e77da731d78970aae36510c421050d1182fb.tar.gz gsoc2013-evolution-3bc3e77da731d78970aae36510c421050d1182fb.tar.zst gsoc2013-evolution-3bc3e77da731d78970aae36510c421050d1182fb.zip |
new EBookOp destructor (e_book_unqueue_op): use e_book_op_free
2001-08-06 Radek Doulik <rodo@ximian.com>
* backend/ebook/e-book.c (e_book_op_free): new EBookOp destructor
(e_book_unqueue_op): use e_book_op_free
(e_book_do_response_create_card): ditto
(e_book_do_response_generic): ditto
(e_book_do_response_get_cursor): ditto
(e_book_do_response_get_view): ditto
(e_book_do_response_get_changes): ditto
(e_book_do_response_open): ditto
(e_book_do_response_get_supported_fields): ditto
svn path=/trunk/; revision=11696
Diffstat (limited to 'addressbook/backend/ebook/e-book.c')
-rw-r--r-- | addressbook/backend/ebook/e-book.c | 38 |
1 files changed, 22 insertions, 16 deletions
diff --git a/addressbook/backend/ebook/e-book.c b/addressbook/backend/ebook/e-book.c index b141a71f43..0046ad1730 100644 --- a/addressbook/backend/ebook/e-book.c +++ b/addressbook/backend/ebook/e-book.c @@ -69,6 +69,17 @@ typedef struct { /* * Local response queue management. */ + +static void +e_book_op_free (EBookOp *op) +{ + if (op->listener) { + bonobo_object_unref (BONOBO_OBJECT (op->listener)); + op->listener = NULL; + } + g_free (op); +} + static guint e_book_queue_op (EBook *book, gpointer cb, @@ -84,6 +95,9 @@ e_book_queue_op (EBook *book, op->closure = closure; op->listener = listener; + if (op->listener) + bonobo_object_ref (BONOBO_OBJECT (op->listener)); + book->priv->pending_ops = g_list_append (book->priv->pending_ops, op); @@ -105,7 +119,7 @@ e_book_unqueue_op (EBook *book) book->priv->pending_ops = g_list_remove_link (book->priv->pending_ops, removed); op = removed->data; - g_free (op); + e_book_op_free (op); g_list_free_1 (removed); book->priv->op_tag--; } @@ -166,7 +180,7 @@ e_book_do_response_create_card (EBook *book, if (op->cb) ((EBookIdCallback) op->cb) (book, resp->status, resp->id, op->closure); g_free (resp->id); - g_free (op); + e_book_op_free (op); } static void @@ -185,7 +199,7 @@ e_book_do_response_generic (EBook *book, if (op->cb) ((EBookCallback) op->cb) (book, resp->status, op->closure); - g_free (op); + e_book_op_free (op); } static void @@ -233,11 +247,9 @@ e_book_do_response_get_cursor (EBook *book, ((EBookCursorCallback) op->cb) (book, E_BOOK_STATUS_CANCELLED, NULL, op->closure); } - g_free (op); + e_book_op_free (op); } - - static void e_book_do_response_get_view (EBook *book, EBookListenerResponse *resp) @@ -289,10 +301,7 @@ e_book_do_response_get_view (EBook *book, ((EBookBookViewCallback) op->cb) (book, E_BOOK_STATUS_CANCELLED, NULL, op->closure); } - bonobo_object_unref(BONOBO_OBJECT(op->listener)); - op->listener = NULL; - - g_free (op); + e_book_op_free (op); } static void @@ -343,10 +352,7 @@ e_book_do_response_get_changes (EBook *book, ((EBookBookViewCallback) op->cb) (book, E_BOOK_STATUS_CANCELLED, NULL, op->closure); } - bonobo_object_unref(BONOBO_OBJECT(op->listener)); - op->listener = NULL; - - g_free (op); + e_book_op_free (op); } static void @@ -370,7 +376,7 @@ e_book_do_response_open (EBook *book, if (op->cb) ((EBookCallback) op->cb) (book, resp->status, op->closure); - g_free (op); + e_book_op_free (op); } static void @@ -420,7 +426,7 @@ e_book_do_response_get_supported_fields (EBook *book, ((EBookFieldsCallback) op->cb) (book, E_BOOK_STATUS_CANCELLED, NULL, op->closure); } - g_free (op); + e_book_op_free (op); } /* |