aboutsummaryrefslogtreecommitdiffstats
path: root/addressbook
diff options
context:
space:
mode:
authorChris Toshok <toshok@ximian.com>2002-11-10 17:49:37 +0800
committerChris Toshok <toshok@src.gnome.org>2002-11-10 17:49:37 +0800
commit9aa24e5bd2d516b9722db784a16fd3ef838037a1 (patch)
treecf9bfd4dacba4a19b7c2b0d57d9d79757c7ed55d /addressbook
parent28bc0361b9db902a9bcca18cfc5c1b9cc37a7229 (diff)
downloadgsoc2013-evolution-9aa24e5bd2d516b9722db784a16fd3ef838037a1.tar
gsoc2013-evolution-9aa24e5bd2d516b9722db784a16fd3ef838037a1.tar.gz
gsoc2013-evolution-9aa24e5bd2d516b9722db784a16fd3ef838037a1.tar.bz2
gsoc2013-evolution-9aa24e5bd2d516b9722db784a16fd3ef838037a1.tar.lz
gsoc2013-evolution-9aa24e5bd2d516b9722db784a16fd3ef838037a1.tar.xz
gsoc2013-evolution-9aa24e5bd2d516b9722db784a16fd3ef838037a1.tar.zst
gsoc2013-evolution-9aa24e5bd2d516b9722db784a16fd3ef838037a1.zip
guard against multiple invocations.
2002-11-10 Chris Toshok <toshok@ximian.com> * 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
Diffstat (limited to 'addressbook')
-rw-r--r--addressbook/ChangeLog33
-rw-r--r--addressbook/backend/ebook/e-book-listener.c35
-rw-r--r--addressbook/backend/ebook/e-book-view-listener.c48
-rw-r--r--addressbook/backend/ebook/e-book.c47
-rw-r--r--addressbook/backend/ebook/e-card-cursor.c38
-rw-r--r--addressbook/backend/ebook/e-card-simple.c47
-rw-r--r--addressbook/backend/ebook/e-card.c72
-rw-r--r--addressbook/backend/ebook/e-destination.c17
-rw-r--r--addressbook/backend/pas/pas-backend-card-sexp.c13
-rw-r--r--addressbook/backend/pas/pas-backend-file.c15
-rw-r--r--addressbook/backend/pas/pas-backend-ldap.c28
-rw-r--r--addressbook/backend/pas/pas-backend-summary.c32
-rw-r--r--addressbook/backend/pas/pas-book-factory.c71
-rw-r--r--addressbook/backend/pas/pas-book-view.c16
-rw-r--r--addressbook/backend/pas/pas-book.c51
15 files changed, 334 insertions, 229 deletions
diff --git a/addressbook/ChangeLog b/addressbook/ChangeLog
index b8c1dce9a5..6a884e8865 100644
--- a/addressbook/ChangeLog
+++ b/addressbook/ChangeLog
@@ -1,3 +1,36 @@
+2002-11-10 Chris Toshok <toshok@ximian.com>
+
+ * 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.
+
2002-11-08 Chris Toshok <toshok@ximian.com>
* gui/widgets/e-addressbook-model.c (free_data): guard against
diff --git a/addressbook/backend/ebook/e-book-listener.c b/addressbook/backend/ebook/e-book-listener.c
index ffcd1fe127..6fb9b737ae 100644
--- a/addressbook/backend/ebook/e-book-listener.c
+++ b/addressbook/backend/ebook/e-book-listener.c
@@ -690,25 +690,32 @@ static void
e_book_listener_dispose (GObject *object)
{
EBookListener *listener = E_BOOK_LISTENER (object);
- GList *l;
- /* Remove our response queue handler: In theory, this can never happen since we
- always hold a reference to the listener while the timeout is running. */
- if (listener->priv->timeout_id) {
- g_source_remove (listener->priv->timeout_id);
- }
+ if (listener->priv) {
+ GList *l;
- /* Clean up anything still sitting in response_queue */
- for (l = listener->priv->response_queue; l != NULL; l = l->next) {
- EBookListenerResponse *resp = l->data;
+ /* Remove our response queue handler: In theory, this
+ can never happen since we always hold a reference
+ to the listener while the timeout is running. */
+ if (listener->priv->timeout_id) {
+ g_source_remove (listener->priv->timeout_id);
+ }
- response_free (resp);
- }
- g_list_free (listener->priv->response_queue);
+ /* Clean up anything still sitting in response_queue */
+ for (l = listener->priv->response_queue; l != NULL; l = l->next) {
+ EBookListenerResponse *resp = l->data;
- g_free (listener->priv);
+ response_free (resp);
+ }
+ g_list_free (listener->priv->response_queue);
+
+ g_free (listener->priv);
+
+ listener->priv = NULL;
+ }
- G_OBJECT_CLASS (parent_class)->dispose (object);
+ if (G_OBJECT_CLASS (parent_class)->dispose)
+ G_OBJECT_CLASS (parent_class)->dispose (object);
}
static void
diff --git a/addressbook/backend/ebook/e-book-view-listener.c b/addressbook/backend/ebook/e-book-view-listener.c
index 1ac4a7ef83..fe50cf037b 100644
--- a/addressbook/backend/ebook/e-book-view-listener.c
+++ b/addressbook/backend/ebook/e-book-view-listener.c
@@ -374,35 +374,39 @@ static void
e_book_view_listener_dispose (GObject *object)
{
EBookViewListener *listener = E_BOOK_VIEW_LISTENER (object);
- GList *l;
-
- /* Remove our response queue handler: In theory, this can never happen since we
- always hold a reference to the listener while the timeout is running. */
- if (listener->priv->timeout_id) {
- g_source_remove (listener->priv->timeout_id);
- }
- /* Clear out the queue */
- for (l = listener->priv->response_queue; l != NULL; l = l->next) {
- EBookViewListenerResponse *resp = l->data;
+ if (listener->priv) {
+ GList *l;
+ /* Remove our response queue handler: In theory, this
+ can never happen since we always hold a reference
+ to the listener while the timeout is running. */
+ if (listener->priv->timeout_id) {
+ g_source_remove (listener->priv->timeout_id);
+ }
- g_free(resp->id);
+ /* Clear out the queue */
+ for (l = listener->priv->response_queue; l != NULL; l = l->next) {
+ EBookViewListenerResponse *resp = l->data;
- g_list_foreach(resp->cards, (GFunc) g_object_unref, NULL);
- g_list_free(resp->cards);
- resp->cards = NULL;
+ g_free(resp->id);
- g_free (resp->message);
- resp->message = NULL;
+ g_list_foreach(resp->cards, (GFunc) g_object_unref, NULL);
+ g_list_free(resp->cards);
+ resp->cards = NULL;
- g_free (resp);
- }
- g_list_free (listener->priv->response_queue);
+ g_free (resp->message);
+ resp->message = NULL;
+
+ g_free (resp);
+ }
+ g_list_free (listener->priv->response_queue);
- g_free (listener->priv);
- listener->priv = NULL;
+ g_free (listener->priv);
+ listener->priv = NULL;
+ }
- G_OBJECT_CLASS (parent_class)->dispose (object);
+ if (G_OBJECT_CLASS (parent_class)->dispose)
+ G_OBJECT_CLASS (parent_class)->dispose (object);
}
static void
diff --git a/addressbook/backend/ebook/e-book.c b/addressbook/backend/ebook/e-book.c
index 40938b1e8f..e236bc04ea 100644
--- a/addressbook/backend/ebook/e-book.c
+++ b/addressbook/backend/ebook/e-book.c
@@ -1477,35 +1477,42 @@ static void
e_book_dispose (GObject *object)
{
EBook *book = E_BOOK (object);
- CORBA_Environment ev;
- GList *l;
- if (book->priv->load_state == URILoaded)
- e_book_unload_uri (book);
+ if (book->priv) {
+ CORBA_Environment ev;
+ GList *l;
- CORBA_exception_init (&ev);
+ if (book->priv->load_state == URILoaded)
+ e_book_unload_uri (book);
- for (l = book->priv->book_factories; l; l = l->next) {
- CORBA_Object_release ((CORBA_Object)l->data, &ev);
- if (ev._major != CORBA_NO_EXCEPTION) {
- g_warning ("EBook: Exception while releasing BookFactory\n");
+ CORBA_exception_init (&ev);
+
+ for (l = book->priv->book_factories; l; l = l->next) {
+ CORBA_Object_release ((CORBA_Object)l->data, &ev);
+ if (ev._major != CORBA_NO_EXCEPTION) {
+ g_warning ("EBook: Exception while releasing BookFactory\n");
- CORBA_exception_free (&ev);
- CORBA_exception_init (&ev);
+ CORBA_exception_free (&ev);
+ CORBA_exception_init (&ev);
+ }
}
- }
- if (book->priv->comp_listener) {
- g_signal_handler_disconnect (book->priv->comp_listener, book->priv->died_signal);
- g_object_unref (book->priv->comp_listener);
- book->priv->comp_listener = NULL;
- }
+ CORBA_exception_free (&ev);
- g_free (book->priv->uri);
+ if (book->priv->comp_listener) {
+ g_signal_handler_disconnect (book->priv->comp_listener, book->priv->died_signal);
+ g_object_unref (book->priv->comp_listener);
+ book->priv->comp_listener = NULL;
+ }
+
+ g_free (book->priv->uri);
- g_free (book->priv);
+ g_free (book->priv);
+ book->priv = NULL;
+ }
- G_OBJECT_CLASS (parent_class)->dispose (object);
+ if (G_OBJECT_CLASS (parent_class)->dispose)
+ G_OBJECT_CLASS (parent_class)->dispose (object);
}
static void
diff --git a/addressbook/backend/ebook/e-card-cursor.c b/addressbook/backend/ebook/e-card-cursor.c
index 4c96338a52..0aa9c8c1e0 100644
--- a/addressbook/backend/ebook/e-card-cursor.c
+++ b/addressbook/backend/ebook/e-card-cursor.c
@@ -26,32 +26,36 @@ static void
e_card_cursor_dispose (GObject *object)
{
ECardCursor *cursor = E_CARD_CURSOR (object);
- CORBA_Environment ev;
-
- CORBA_exception_init (&ev);
- GNOME_Evolution_Addressbook_CardCursor_unref( cursor->priv->corba_cursor, &ev );
+ if (cursor->priv) {
+ CORBA_Environment ev;
- if (ev._major != CORBA_NO_EXCEPTION) {
- g_warning("e_card_cursor_destroy: Exception unreffing "
- "corba cursor.\n");
- CORBA_exception_free (&ev);
CORBA_exception_init (&ev);
- }
- CORBA_Object_release (cursor->priv->corba_cursor, &ev);
+ GNOME_Evolution_Addressbook_CardCursor_unref( cursor->priv->corba_cursor, &ev );
- if (ev._major != CORBA_NO_EXCEPTION) {
- g_warning("e_card_cursor_destroy: Exception releasing "
- "corba cursor.\n");
- }
+ if (ev._major != CORBA_NO_EXCEPTION) {
+ g_warning("e_card_cursor_destroy: Exception unreffing "
+ "corba cursor.\n");
+ CORBA_exception_free (&ev);
+ CORBA_exception_init (&ev);
+ }
- CORBA_exception_free (&ev);
+ CORBA_Object_release (cursor->priv->corba_cursor, &ev);
+
+ if (ev._major != CORBA_NO_EXCEPTION) {
+ g_warning("e_card_cursor_destroy: Exception releasing "
+ "corba cursor.\n");
+ }
+
+ CORBA_exception_free (&ev);
- if ( cursor->priv )
g_free ( cursor->priv );
+ cursor->priv = NULL;
+ }
- G_OBJECT_CLASS (parent_class)->dispose (object);
+ if (G_OBJECT_CLASS (parent_class)->dispose)
+ G_OBJECT_CLASS (parent_class)->dispose (object);
}
/**
diff --git a/addressbook/backend/ebook/e-card-simple.c b/addressbook/backend/ebook/e-card-simple.c
index b033b81d55..6b1f057c22 100644
--- a/addressbook/backend/ebook/e-card-simple.c
+++ b/addressbook/backend/ebook/e-card-simple.c
@@ -349,22 +349,43 @@ e_card_simple_dispose (GObject *object)
simple = E_CARD_SIMPLE (object);
- if (simple->card)
+ if (simple->card) {
g_object_unref(simple->card);
- g_list_foreach(simple->temp_fields, (GFunc) g_free, NULL);
- g_list_free(simple->temp_fields);
- simple->temp_fields = NULL;
+ simple->card = NULL;
+ }
+ if (simple->temp_fields) {
+ g_list_foreach(simple->temp_fields, (GFunc) g_free, NULL);
+ g_list_free(simple->temp_fields);
+ simple->temp_fields = NULL;
+ }
- for(i = 0; i < E_CARD_SIMPLE_PHONE_ID_LAST; i++)
- e_card_phone_unref (simple->phone[i]);
- for(i = 0; i < E_CARD_SIMPLE_EMAIL_ID_LAST; i++)
- g_free(simple->email[i]);
- for(i = 0; i < E_CARD_SIMPLE_ADDRESS_ID_LAST; i++)
- e_card_address_label_unref(simple->address[i]);
- for(i = 0; i < E_CARD_SIMPLE_ADDRESS_ID_LAST; i++)
- e_card_delivery_address_unref(simple->delivery[i]);
+ for(i = 0; i < E_CARD_SIMPLE_PHONE_ID_LAST; i++) {
+ if (simple->phone[i]) {
+ e_card_phone_unref (simple->phone[i]);
+ simple->phone[i] = NULL;
+ }
+ }
+ for(i = 0; i < E_CARD_SIMPLE_EMAIL_ID_LAST; i++) {
+ if (simple->email[i]) {
+ g_free(simple->email[i]);
+ simple->email[i] = NULL;
+ }
+ }
+ for(i = 0; i < E_CARD_SIMPLE_ADDRESS_ID_LAST; i++) {
+ if (simple->address[i]) {
+ e_card_address_label_unref(simple->address[i]);
+ simple->address[i] = NULL;
+ }
+ }
+ for(i = 0; i < E_CARD_SIMPLE_ADDRESS_ID_LAST; i++) {
+ if (simple->delivery[i]) {
+ e_card_delivery_address_unref(simple->delivery[i]);
+ simple->delivery[i] = NULL;
+ }
+ }
- G_OBJECT_CLASS (parent_class)->dispose (object);
+ if (G_OBJECT_CLASS (parent_class)->dispose)
+ G_OBJECT_CLASS (parent_class)->dispose (object);
}
diff --git a/addressbook/backend/ebook/e-card.c b/addressbook/backend/ebook/e-card.c
index f98269dff5..07926ddd84 100644
--- a/addressbook/backend/ebook/e-card.c
+++ b/addressbook/backend/ebook/e-card.c
@@ -1997,42 +1997,44 @@ static void
e_card_dispose (GObject *object)
{
ECard *card = E_CARD(object);
- g_free(card->id);
- if (card->book)
- g_object_unref (card->book);
- g_free(card->file_as);
- g_free(card->fname);
- e_card_name_unref(card->name);
- g_free(card->bday);
-
- g_free(card->url);
- g_free(card->org);
- g_free(card->org_unit);
- g_free(card->office);
- g_free(card->title);
- g_free(card->role);
- g_free(card->manager);
- g_free(card->assistant);
- g_free(card->nickname);
- g_free(card->spouse);
- g_free(card->anniversary);
- g_free(card->caluri);
- g_free(card->fburl);
- g_free(card->note);
- g_free(card->related_contacts);
- if (card->categories)
- g_object_unref(card->categories);
- if (card->email)
- g_object_unref(card->email);
- if (card->phone)
- g_object_unref(card->phone);
- if (card->address)
- g_object_unref(card->address);
- if (card->address_label)
- g_object_unref(card->address_label);
-
- G_OBJECT_CLASS (parent_class)->dispose (object);
+#define FREE_IF(x) do { if ((x)) { g_free (x); x = NULL; } } while (0)
+#define UNREF_IF(x) do { if ((x)) { g_object_unref (x); x = NULL; } } while (0)
+
+ FREE_IF (card->id);
+ UNREF_IF (card->book);
+ FREE_IF(card->file_as);
+ FREE_IF(card->fname);
+ if (card->name) {
+ e_card_name_unref(card->name);
+ card->name = NULL;
+ }
+ FREE_IF(card->bday);
+
+ FREE_IF(card->url);
+ FREE_IF(card->org);
+ FREE_IF(card->org_unit);
+ FREE_IF(card->office);
+ FREE_IF(card->title);
+ FREE_IF(card->role);
+ FREE_IF(card->manager);
+ FREE_IF(card->assistant);
+ FREE_IF(card->nickname);
+ FREE_IF(card->spouse);
+ FREE_IF(card->anniversary);
+ FREE_IF(card->caluri);
+ FREE_IF(card->fburl);
+ FREE_IF(card->note);
+ FREE_IF(card->related_contacts);
+
+ UNREF_IF (card->categories);
+ UNREF_IF (card->email);
+ UNREF_IF (card->phone);
+ UNREF_IF (card->address);
+ UNREF_IF (card->address_label);
+
+ if (G_OBJECT_CLASS (parent_class)->dispose)
+ G_OBJECT_CLASS (parent_class)->dispose (object);
}
diff --git a/addressbook/backend/ebook/e-destination.c b/addressbook/backend/ebook/e-destination.c
index 6537ea7480..86108125cb 100644
--- a/addressbook/backend/ebook/e-destination.c
+++ b/addressbook/backend/ebook/e-destination.c
@@ -96,17 +96,20 @@ e_destination_dispose (GObject *obj)
{
EDestination *dest = E_DESTINATION (obj);
- e_destination_clear (dest);
+ if (dest->priv) {
+ e_destination_clear (dest);
- if (dest->priv->old_card)
- g_object_unref (dest->priv->old_card);
+ if (dest->priv->old_card)
+ g_object_unref (dest->priv->old_card);
- if (dest->priv->cardify_book)
- g_object_unref (dest->priv->cardify_book);
+ if (dest->priv->cardify_book)
+ g_object_unref (dest->priv->cardify_book);
- g_free (dest->priv->old_textrep);
+ g_free (dest->priv->old_textrep);
- g_free (dest->priv);
+ g_free (dest->priv);
+ dest->priv = NULL;
+ }
}
static void
diff --git a/addressbook/backend/pas/pas-backend-card-sexp.c b/addressbook/backend/pas/pas-backend-card-sexp.c
index f79046def1..8c6e2fc003 100644
--- a/addressbook/backend/pas/pas-backend-card-sexp.c
+++ b/addressbook/backend/pas/pas-backend-card-sexp.c
@@ -409,12 +409,17 @@ static void
pas_backend_card_sexp_dispose (GObject *object)
{
PASBackendCardSExp *sexp = PAS_BACKEND_CARD_SEXP (object);
- e_sexp_unref(sexp->priv->search_sexp);
- g_free (sexp->priv->search_context);
- g_free (sexp->priv);
+ if (sexp->priv) {
+ e_sexp_unref(sexp->priv->search_sexp);
- G_OBJECT_CLASS (parent_class)->dispose (object);
+ g_free (sexp->priv->search_context);
+ g_free (sexp->priv);
+ sexp->priv = NULL;
+ }
+
+ if (G_OBJECT_CLASS (parent_class)->dispose)
+ G_OBJECT_CLASS (parent_class)->dispose (object);
}
static void
diff --git a/addressbook/backend/pas/pas-backend-file.c b/addressbook/backend/pas/pas-backend-file.c
index 0b61ccd16f..ff8f9802a1 100644
--- a/addressbook/backend/pas/pas-backend-file.c
+++ b/addressbook/backend/pas/pas-backend-file.c
@@ -1628,12 +1628,15 @@ pas_backend_file_dispose (GObject *object)
bf = PAS_BACKEND_FILE (object);
- g_object_unref(bf->priv->book_views);
- g_object_unref(bf->priv->summary);
- g_free (bf->priv->uri);
- g_free (bf->priv->filename);
-
- g_free (bf->priv);
+ if (bf->priv) {
+ g_object_unref(bf->priv->book_views);
+ g_object_unref(bf->priv->summary);
+ g_free (bf->priv->uri);
+ g_free (bf->priv->filename);
+
+ g_free (bf->priv);
+ bf->priv = NULL;
+ }
G_OBJECT_CLASS (pas_backend_file_parent_class)->dispose (object);
}
diff --git a/addressbook/backend/pas/pas-backend-ldap.c b/addressbook/backend/pas/pas-backend-ldap.c
index cf464ba4e6..010e8d104e 100644
--- a/addressbook/backend/pas/pas-backend-ldap.c
+++ b/addressbook/backend/pas/pas-backend-ldap.c
@@ -3436,22 +3436,28 @@ pas_backend_ldap_dispose (GObject *object)
bl = PAS_BACKEND_LDAP (object);
- g_hash_table_foreach_remove (bl->priv->id_to_op, (GHRFunc)call_dtor, NULL);
- g_hash_table_destroy (bl->priv->id_to_op);
+ if (bl->priv) {
+ g_hash_table_foreach_remove (bl->priv->id_to_op, (GHRFunc)call_dtor, NULL);
+ g_hash_table_destroy (bl->priv->id_to_op);
- if (bl->priv->poll_timeout != -1) {
- printf ("removing timeout\n");
- g_source_remove (bl->priv->poll_timeout);
- }
+ if (bl->priv->poll_timeout != -1) {
+ printf ("removing timeout\n");
+ g_source_remove (bl->priv->poll_timeout);
+ }
- g_object_unref (bl->priv->book_views);
+ g_object_unref (bl->priv->book_views);
- if (bl->priv->supported_fields)
- g_object_unref (bl->priv->supported_fields);
+ if (bl->priv->supported_fields)
+ g_object_unref (bl->priv->supported_fields);
- g_free (bl->priv->uri);
+ g_free (bl->priv->uri);
+
+ g_free (bl->priv);
+ bl->priv = NULL;
+ }
- G_OBJECT_CLASS (pas_backend_ldap_parent_class)->dispose (object);
+ if (G_OBJECT_CLASS (pas_backend_ldap_parent_class)->dispose)
+ G_OBJECT_CLASS (pas_backend_ldap_parent_class)->dispose (object);
}
static void
diff --git a/addressbook/backend/pas/pas-backend-summary.c b/addressbook/backend/pas/pas-backend-summary.c
index a8683912f9..6c2c9a45c8 100644
--- a/addressbook/backend/pas/pas-backend-summary.c
+++ b/addressbook/backend/pas/pas-backend-summary.c
@@ -150,26 +150,30 @@ pas_backend_summary_dispose (GObject *object)
{
PASBackendSummary *summary = PAS_BACKEND_SUMMARY (object);
- if (summary->priv->dirty)
- g_warning ("Destroying dirty summary");
+ if (summary->priv) {
+ if (summary->priv->dirty)
+ g_warning ("Destroying dirty summary");
- if (summary->priv->flush_timeout) {
- g_source_remove (summary->priv->flush_timeout);
- summary->priv->flush_timeout = 0;
- }
+ if (summary->priv->flush_timeout) {
+ g_source_remove (summary->priv->flush_timeout);
+ summary->priv->flush_timeout = 0;
+ }
- if (summary->priv->fp)
- fclose (summary->priv->fp);
+ if (summary->priv->fp)
+ fclose (summary->priv->fp);
- g_free (summary->priv->summary_path);
- clear_items (summary);
- g_ptr_array_free (summary->priv->items, TRUE);
+ g_free (summary->priv->summary_path);
+ clear_items (summary);
+ g_ptr_array_free (summary->priv->items, TRUE);
- g_hash_table_destroy (summary->priv->id_to_item);
+ g_hash_table_destroy (summary->priv->id_to_item);
- g_free (summary->priv);
+ g_free (summary->priv);
+ summary->priv = NULL;
+ }
- G_OBJECT_CLASS (parent_class)->dispose (object);
+ if (G_OBJECT_CLASS (parent_class)->dispose)
+ G_OBJECT_CLASS (parent_class)->dispose (object);
}
static void
diff --git a/addressbook/backend/pas/pas-book-factory.c b/addressbook/backend/pas/pas-book-factory.c
index 5ca1af6acc..e775553958 100644
--- a/addressbook/backend/pas/pas-book-factory.c
+++ b/addressbook/backend/pas/pas-book-factory.c
@@ -513,47 +513,52 @@ static void
pas_book_factory_dispose (GObject *object)
{
PASBookFactory *factory = PAS_BOOK_FACTORY (object);
- PASBookFactoryPrivate *priv = factory->priv;
- GList *l;
+ if (factory->priv) {
+ PASBookFactoryPrivate *priv = factory->priv;
+ GList *l;
- for (l = priv->queued_requests; l != NULL; l = l->next) {
- PASBookFactoryQueuedRequest *request = l->data;
- CORBA_Environment ev;
-
- g_free (request->uri);
-
- CORBA_exception_init (&ev);
- CORBA_Object_release (request->listener, &ev);
- CORBA_exception_free (&ev);
-
- g_free (request);
- }
- g_list_free (priv->queued_requests);
- priv->queued_requests = NULL;
+ for (l = priv->queued_requests; l != NULL; l = l->next) {
+ PASBookFactoryQueuedRequest *request = l->data;
+ CORBA_Environment ev;
- g_hash_table_foreach (priv->active_server_map,
- free_active_server_map_entry,
- NULL);
- g_hash_table_destroy (priv->active_server_map);
- priv->active_server_map = NULL;
+ g_free (request->uri);
- g_hash_table_foreach (priv->backends,
- remove_backends_entry,
- NULL);
- g_hash_table_destroy (priv->backends);
- priv->backends = NULL;
+ CORBA_exception_init (&ev);
+ CORBA_Object_release (request->listener, &ev);
+ CORBA_exception_free (&ev);
- if (priv->registered) {
- bonobo_activation_active_server_unregister (priv->iid, bonobo_object_corba_objref (BONOBO_OBJECT (factory)));
- priv->registered = FALSE;
- }
+ g_free (request);
+ }
+ g_list_free (priv->queued_requests);
+ priv->queued_requests = NULL;
+
+ g_hash_table_foreach (priv->active_server_map,
+ free_active_server_map_entry,
+ NULL);
+ g_hash_table_destroy (priv->active_server_map);
+ priv->active_server_map = NULL;
+
+ g_hash_table_foreach (priv->backends,
+ remove_backends_entry,
+ NULL);
+ g_hash_table_destroy (priv->backends);
+ priv->backends = NULL;
+
+ if (priv->registered) {
+ bonobo_activation_active_server_unregister (priv->iid,
+ bonobo_object_corba_objref (BONOBO_OBJECT (factory)));
+ priv->registered = FALSE;
+ }
- g_free (priv->iid);
+ g_free (priv->iid);
- g_free (priv);
+ g_free (priv);
+ factory->priv = NULL;
+ }
- G_OBJECT_CLASS (pas_book_factory_parent_class)->dispose (object);
+ if (G_OBJECT_CLASS (pas_book_factory_parent_class)->dispose)
+ G_OBJECT_CLASS (pas_book_factory_parent_class)->dispose (object);
}
static void
diff --git a/addressbook/backend/pas/pas-book-view.c b/addressbook/backend/pas/pas-book-view.c
index 722732beb9..22b32c4604 100644
--- a/addressbook/backend/pas/pas-book-view.c
+++ b/addressbook/backend/pas/pas-book-view.c
@@ -207,20 +207,16 @@ static void
pas_book_view_dispose (GObject *object)
{
PASBookView *book_view = PAS_BOOK_VIEW (object);
- CORBA_Environment ev;
- CORBA_exception_init (&ev);
- bonobo_object_release_unref (book_view->priv->listener, &ev);
- if (ev._major != CORBA_NO_EXCEPTION) {
- CORBA_exception_free (&ev);
+ if (book_view->priv) {
+ bonobo_object_release_unref (book_view->priv->listener, NULL);
- return;
+ g_free (book_view->priv);
+ book_view->priv = NULL;
}
- CORBA_exception_free (&ev);
-
- g_free (book_view->priv);
- G_OBJECT_CLASS (pas_book_view_parent_class)->dispose (object);
+ if (G_OBJECT_CLASS (pas_book_view_parent_class)->dispose)
+ G_OBJECT_CLASS (pas_book_view_parent_class)->dispose (object);
}
static void
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