aboutsummaryrefslogtreecommitdiffstats
path: root/addressbook/backend/pas
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/backend/pas
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/backend/pas')
-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
7 files changed, 125 insertions, 101 deletions
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