From 9aa24e5bd2d516b9722db784a16fd3ef838037a1 Mon Sep 17 00:00:00 2001 From: Chris Toshok Date: Sun, 10 Nov 2002 09:49:37 +0000 Subject: guard against multiple invocations. 2002-11-10 Chris Toshok * backend/pas/pas-backend-card-sexp.c (pas_backend_card_sexp_dispose): guard against multiple invocations. * backend/pas/pas-card-cursor.c (pas_card_cursor_dispose): same. * backend/pas/pas-book.c (pas_book_dispose): same. * backend/pas/pas-book-view.c (pas_book_view_dispose): same. * backend/pas/pas-book-factory.c (pas_book_factory_dispose): same. * backend/pas/pas-backend-summary.c (pas_backend_summary_dispose): same. * backend/pas/pas-backend-ldap.c (pas_backend_ldap_dispose): same. * backend/pas/pas-backend-file.c (pas_backend_file_dispose): same. * backend/ebook/e-book-listener.c (e_book_listener_dispose): guard against multiple invocations. * backend/ebook/e-card.c (e_card_dispose): same. * backend/ebook/e-card-simple.c (e_card_simple_dispose): same. * backend/ebook/e-card-cursor.c (e_card_cursor_dispose): same. * backend/ebook/e-book.c (e_book_dispose): same. * backend/ebook/e-book-view-listener.c (e_book_view_listener_dispose): same. svn path=/trunk/; revision=18687 --- addressbook/backend/pas/pas-book.c | 51 +++++++++++++++++++++----------------- 1 file changed, 28 insertions(+), 23 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 f43c73da64..9ca049e350 100644 --- a/addressbook/backend/pas/pas-book.c +++ b/addressbook/backend/pas/pas-book.c @@ -870,35 +870,40 @@ static void pas_book_dispose (GObject *object) { PASBook *book = PAS_BOOK (object); - GList *l; - CORBA_Environment ev; - for (l = book->priv->request_queue; l != NULL; l = l->next) { - pas_book_free_request ((PASRequest *)l->data); - } - 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; - } + if (book->priv) { + GList *l; + CORBA_Environment ev; + + for (l = book->priv->request_queue; l != NULL; l = l->next) { + pas_book_free_request ((PASRequest *)l->data); + } + 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); + CORBA_exception_init (&ev); + CORBA_Object_release (book->priv->listener, &ev); - if (ev._major != CORBA_NO_EXCEPTION) - g_message ("pas_book_construct(): could not release the listener"); + if (ev._major != CORBA_NO_EXCEPTION) + g_message ("pas_book_construct(): could not release the listener"); - CORBA_exception_free (&ev); + CORBA_exception_free (&ev); - g_free (book->priv); - book->priv = NULL; + g_free (book->priv); + book->priv = NULL; + } - G_OBJECT_CLASS (pas_book_parent_class)->dispose (object); + if (G_OBJECT_CLASS (pas_book_parent_class)->dispose) + G_OBJECT_CLASS (pas_book_parent_class)->dispose (object); } static void -- cgit v1.2.3