From 41fd8740f435090489e73b3540ace4d6dc1a18bf Mon Sep 17 00:00:00 2001 From: Jon Trowbridge Date: Sat, 27 Oct 2001 18:26:34 +0000 Subject: That should be a bonobo_object_unref, not a gtk_object_unref. 2001-10-27 Jon Trowbridge * backend/pas/pas-book.c (pas_book_check_queue): That should be a bonobo_object_unref, not a gtk_object_unref. (pas_book_queue_request): Likewise, we need to bonobo_object_ref here. (pas_book_destroy): If our pas_book_check_queue timeout is still active, disable it. This should never happen, but it never hurts to be careful. (pas_book_destroy): Set book->priv to NULL after we free it. svn path=/trunk/; revision=14218 --- addressbook/backend/pas/pas-book.c | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) (limited to 'addressbook/backend/pas/pas-book.c') diff --git a/addressbook/backend/pas/pas-book.c b/addressbook/backend/pas/pas-book.c index e67ae51842..d51d182dad 100644 --- a/addressbook/backend/pas/pas-book.c +++ b/addressbook/backend/pas/pas-book.c @@ -46,7 +46,7 @@ pas_book_check_queue (PASBook *book) if (book->priv->request_queue == NULL) { book->priv->timeout_id = 0; book->priv->timeout_lock = FALSE; - gtk_object_unref (GTK_OBJECT (book)); + bonobo_object_unref (BONOBO_OBJECT (book)); return FALSE; } @@ -62,7 +62,7 @@ pas_book_queue_request (PASBook *book, PASRequest *req) g_list_append (book->priv->request_queue, req); if (book->priv->timeout_id == 0) { - gtk_object_ref (GTK_OBJECT (book)); + bonobo_object_ref (BONOBO_OBJECT (book)); book->priv->timeout_id = g_timeout_add (20, (GSourceFunc) pas_book_check_queue, book); } } @@ -780,6 +780,15 @@ pas_book_destroy (GtkObject *object) } g_list_free (book->priv->request_queue); + /* We should never ever have timeout_id == 0 when we get destroyed, unless there + is some sort of reference counting bug. Still, we do this to try to avoid + horrible crashes in those situations. */ + if (book->priv->timeout_id) { + g_warning ("PASBook destroyed with non-zero timeout_id. This shouldn't happen."); + g_source_remove (book->priv->timeout_id); + book->priv->timeout_id = 0; + } + CORBA_exception_init (&ev); CORBA_Object_release (book->priv->listener, &ev); @@ -789,6 +798,7 @@ pas_book_destroy (GtkObject *object) CORBA_exception_free (&ev); g_free (book->priv); + book->priv = NULL; GTK_OBJECT_CLASS (pas_book_parent_class)->destroy (object); } -- cgit v1.2.3