diff options
author | Jon Trowbridge <trow@ximian.com> | 2001-08-30 11:28:56 +0800 |
---|---|---|
committer | Jon Trowbridge <trow@src.gnome.org> | 2001-08-30 11:28:56 +0800 |
commit | e4c70cd2f525f80332946c788dc57b38e2926eba (patch) | |
tree | f82a8ad1ef774630aef1b1b4a5a6c4e79458fc0c /addressbook | |
parent | 49f07e62b53a29045f5b1195fb7cea28ad389d76 (diff) | |
download | gsoc2013-evolution-e4c70cd2f525f80332946c788dc57b38e2926eba.tar.gz gsoc2013-evolution-e4c70cd2f525f80332946c788dc57b38e2926eba.tar.zst gsoc2013-evolution-e4c70cd2f525f80332946c788dc57b38e2926eba.zip |
This function can be re-entrant during the signal emission; Added extra
2001-08-29 Jon Trowbridge <trow@ximian.com>
* backend/ebook/e-book-listener.c (e_book_listener_check_queue):
This function can be re-entrant during the signal emission; Added
extra ref/unrefs and checks to avoid problems if this happens.
This is similar to my recent changes to
e_book_view_listener_check_queue. (Fixes bug #7400)
svn path=/trunk/; revision=12523
Diffstat (limited to 'addressbook')
-rw-r--r-- | addressbook/ChangeLog | 8 | ||||
-rw-r--r-- | addressbook/backend/ebook/e-book-listener.c | 18 |
2 files changed, 22 insertions, 4 deletions
diff --git a/addressbook/ChangeLog b/addressbook/ChangeLog index e568fe4a27..68432f6abd 100644 --- a/addressbook/ChangeLog +++ b/addressbook/ChangeLog @@ -1,3 +1,11 @@ +2001-08-29 Jon Trowbridge <trow@ximian.com> + + * backend/ebook/e-book-listener.c (e_book_listener_check_queue): + This function can be re-entrant during the signal emission; Added + extra ref/unrefs and checks to avoid problems if this happens. + This is similar to my recent changes to + e_book_view_listener_check_queue. (Fixes bug #7400) + 2001-08-27 Ettore Perazzoli <ettore@ximian.com> * gui/component/addressbook-component.c: Get rid of a warning by diff --git a/addressbook/backend/ebook/e-book-listener.c b/addressbook/backend/ebook/e-book-listener.c index aa05a87a2b..15ceb04bd3 100644 --- a/addressbook/backend/ebook/e-book-listener.c +++ b/addressbook/backend/ebook/e-book-listener.c @@ -35,22 +35,32 @@ struct _EBookListenerPrivate { static gboolean e_book_listener_check_queue (EBookListener *listener) { + gboolean retval; + + /* Hold a reference locally, so that we can't get blown away + 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_listener_signals [RESPONSES_QUEUED]); } - if (listener->priv->response_queue == NULL) { + /* Make sure that ->idle_id != 0, so that only the first reentrant call to + this function unrefs our "global" reference. */ + if (listener->priv->response_queue == NULL && listener->priv->idle_id != 0) { listener->priv->idle_id = 0; /* We only release our reference to the listener when the idle function is totally finished. */ bonobo_object_unref (BONOBO_OBJECT (listener)); - - return FALSE; + retval = FALSE; } - return TRUE; + bonobo_object_unref (BONOBO_OBJECT (listener)); + + return retval; } static void |