diff options
author | Jon Trowbridge <trow@ximian.com> | 2001-08-28 07:03:08 +0800 |
---|---|---|
committer | Jon Trowbridge <trow@src.gnome.org> | 2001-08-28 07:03:08 +0800 |
commit | cf730bc276e041f4dab608f89a1402ebf72d678b (patch) | |
tree | 081aa8a52325098acb268c0365340646f7d83667 /addressbook/backend | |
parent | c36b30533a89dbbf7f84141f1597886598394e06 (diff) | |
download | gsoc2013-evolution-cf730bc276e041f4dab608f89a1402ebf72d678b.tar gsoc2013-evolution-cf730bc276e041f4dab608f89a1402ebf72d678b.tar.gz gsoc2013-evolution-cf730bc276e041f4dab608f89a1402ebf72d678b.tar.bz2 gsoc2013-evolution-cf730bc276e041f4dab608f89a1402ebf72d678b.tar.lz gsoc2013-evolution-cf730bc276e041f4dab608f89a1402ebf72d678b.tar.xz gsoc2013-evolution-cf730bc276e041f4dab608f89a1402ebf72d678b.tar.zst gsoc2013-evolution-cf730bc276e041f4dab608f89a1402ebf72d678b.zip |
Added ref/unref pair to make sure that our listener doesn't get finalized
2001-08-27 Jon Trowbridge <trow@ximian.com>
* backend/ebook/e-book-view-listener.c
(e_book_view_listener_check_queue): Added ref/unref pair to make
sure that our listener doesn't get finalized during the signal
emission and leave us with a dangling pointer. (Bug #7661)
svn path=/trunk/; revision=12493
Diffstat (limited to 'addressbook/backend')
-rw-r--r-- | addressbook/backend/ebook/e-book-view-listener.c | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/addressbook/backend/ebook/e-book-view-listener.c b/addressbook/backend/ebook/e-book-view-listener.c index 761cf12281..c2e5b66106 100644 --- a/addressbook/backend/ebook/e-book-view-listener.c +++ b/addressbook/backend/ebook/e-book-view-listener.c @@ -36,15 +36,24 @@ struct _EBookViewListenerPrivate { static gboolean e_book_view_listener_check_queue (EBookViewListener *listener) { + gboolean retval; + if (listener->priv->stopped) { listener->priv->idle_id = 0; bonobo_object_unref (BONOBO_OBJECT (listener)); return FALSE; } + /* An extra ref to keep listener from being destroyed during the + signal emission. */ + bonobo_object_ref (BONOBO_OBJECT (listener)); + retval = TRUE; + if (listener->priv->response_queue != NULL) { + gtk_signal_emit (GTK_OBJECT (listener), e_book_view_listener_signals [RESPONSES_QUEUED]); + } /* this callback could be (and indeed is) called from signal emited above, @@ -53,10 +62,13 @@ e_book_view_listener_check_queue (EBookViewListener *listener) if (listener->priv->response_queue == NULL && listener->priv->idle_id != 0) { listener->priv->idle_id = 0; bonobo_object_unref (BONOBO_OBJECT (listener)); - return FALSE; + retval = FALSE; } - return TRUE; + /* Drop our extra reference from above. */ + bonobo_object_unref (BONOBO_OBJECT (listener)); + + return retval; } static void |