diff options
-rw-r--r-- | addressbook/ChangeLog | 5 | ||||
-rw-r--r-- | addressbook/backend/ebook/e-book-view-listener.c | 16 |
2 files changed, 19 insertions, 2 deletions
diff --git a/addressbook/ChangeLog b/addressbook/ChangeLog index 08b182a524..20bf17387f 100644 --- a/addressbook/ChangeLog +++ b/addressbook/ChangeLog @@ -1,5 +1,10 @@ 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) + * backend/ebook/e-card.c (e_card_list_send): Removed some debugging spew that I left in by mistake. 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 |