aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--addressbook/ChangeLog8
-rw-r--r--addressbook/backend/ebook/e-book-listener.c18
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