[evolution-data-server/gnome-2-32] Bug #629908 - assertion failed: (E_IS_BOOK (book))



commit 55d0a4df07de2fd7b9b8b25485dd574e440fecf1
Author: David Woodhouse <David Woodhouse intel com>
Date:   Wed Sep 29 10:49:18 2010 +0200

    Bug #629908 - assertion failed: (E_IS_BOOK (book))

 addressbook/libebook/e-book.c |   31 +++++++++++++++-----------
 calendar/libecal/e-cal.c      |   48 +++++++++++++++++++++-------------------
 2 files changed, 43 insertions(+), 36 deletions(-)
---
diff --git a/addressbook/libebook/e-book.c b/addressbook/libebook/e-book.c
index fa8fa8d..3f4ebda 100644
--- a/addressbook/libebook/e-book.c
+++ b/addressbook/libebook/e-book.c
@@ -106,6 +106,9 @@ e_book_error_quark (void)
 	return q;
 }
 
+static void
+gdbus_book_disconnect (EBook *book);
+
 /*
  * Called when the addressbook server dies.
  */
@@ -126,15 +129,7 @@ gdbus_book_closed_cb (GDBusConnection *connection, gboolean remote_peer_vanished
 		g_debug (G_STRLOC ": EBook GDBus connection is closed%s", remote_peer_vanished ? ", remote peer vanished" : "");
 	}
 
-	/* Ensure that everything relevant is NULL */
-	LOCK_FACTORY ();
-
-	if (book->priv->gdbus_book) {
-		g_object_unref (book->priv->gdbus_book);
-		book->priv->gdbus_book = NULL;
-	}
-
-	UNLOCK_FACTORY ();
+	gdbus_book_disconnect (book);
 
 	g_signal_emit (G_OBJECT (book), e_book_signals[BACKEND_DIED], 0);
 }
@@ -148,11 +143,10 @@ gdbus_book_connection_gone_cb (GDBusConnection *connection, const gchar *sender_
 }
 
 static void
-e_book_dispose (GObject *object)
+gdbus_book_disconnect (EBook *book)
 {
-	EBook *book = E_BOOK (object);
-
-	book->priv->loaded = FALSE;
+	/* Ensure that everything relevant is NULL */
+	LOCK_FACTORY ();
 
 	if (book->priv->gdbus_book) {
 		GDBusConnection *connection = g_dbus_proxy_get_connection (G_DBUS_PROXY (book->priv->gdbus_book));
@@ -165,6 +159,17 @@ e_book_dispose (GObject *object)
 		g_object_unref (book->priv->gdbus_book);
 		book->priv->gdbus_book = NULL;
 	}
+	UNLOCK_FACTORY ();
+}
+
+static void
+e_book_dispose (GObject *object)
+{
+	EBook *book = E_BOOK (object);
+
+	book->priv->loaded = FALSE;
+
+	gdbus_book_disconnect (book);
 
 	if (book->priv->source) {
 		g_object_unref (book->priv->source);
diff --git a/calendar/libecal/e-cal.c b/calendar/libecal/e-cal.c
index efdc7c4..50a6a39 100644
--- a/calendar/libecal/e-cal.c
+++ b/calendar/libecal/e-cal.c
@@ -427,6 +427,9 @@ e_cal_init (ECal *ecal)
 	g_static_rec_mutex_init (&priv->cache_lock);
 }
 
+static void
+gdbus_cal_disconnect (ECal *ecal);
+
 /*
  * Called when the calendar server dies.
  */
@@ -449,15 +452,7 @@ gdbus_cal_closed_cb (GDBusConnection *connection, gboolean remote_peer_vanished,
 		g_debug (G_STRLOC ": ECal GDBus connection is closed%s", remote_peer_vanished ? ", remote peer vanished" : "");
 	}
 
-	/* Ensure that everything relevant is NULL */
-	LOCK_FACTORY ();
-
-	if (ecal->priv->gdbus_cal) {
-		g_object_unref (ecal->priv->gdbus_cal);
-		ecal->priv->gdbus_cal = NULL;
-	}
-
-	UNLOCK_FACTORY ();
+	gdbus_cal_disconnect (ecal);
 
         g_signal_emit (G_OBJECT (ecal), e_cal_signals[BACKEND_DIED], 0);
 }
@@ -470,27 +465,24 @@ gdbus_cal_connection_gone_cb (GDBusConnection *connection, const gchar *sender_n
 	gdbus_cal_closed_cb (connection, TRUE, NULL, user_data);
 }
 
-/* Dispose handler for the calendar ecal */
+
 static void
-e_cal_dispose (GObject *object)
+gdbus_cal_disconnect (ECal *ecal)
 {
-	ECal *ecal;
-	ECalPrivate *priv;
-
-	ecal = E_CAL (object);
-	priv = ecal->priv;
+	/* Ensure that everything relevant is NULL */
+	LOCK_FACTORY ();
 
-	if (priv->gdbus_cal) {
+	if (ecal->priv->gdbus_cal) {
 		GError *error = NULL;
-		GDBusConnection *connection = g_dbus_proxy_get_connection (G_DBUS_PROXY (priv->gdbus_cal));
+		GDBusConnection *connection = g_dbus_proxy_get_connection (G_DBUS_PROXY (ecal->priv->gdbus_cal));
 
 		g_signal_handlers_disconnect_by_func (connection, gdbus_cal_closed_cb, ecal);
-		g_dbus_connection_signal_unsubscribe (connection, priv->gone_signal_id);
-		priv->gone_signal_id = 0;
+		g_dbus_connection_signal_unsubscribe (connection, ecal->priv->gone_signal_id);
+		ecal->priv->gone_signal_id = 0;
 
-		e_gdbus_cal_call_close_sync (priv->gdbus_cal, NULL, &error);
-		g_object_unref (priv->gdbus_cal);
-		priv->gdbus_cal = NULL;
+		e_gdbus_cal_call_close_sync (ecal->priv->gdbus_cal, NULL, &error);
+		g_object_unref (ecal->priv->gdbus_cal);
+		ecal->priv->gdbus_cal = NULL;
 
 		if (error) {
 			unwrap_gerror (&error);
@@ -499,6 +491,16 @@ e_cal_dispose (GObject *object)
 			g_error_free (error);
 		}
 	}
+	UNLOCK_FACTORY ();
+}
+
+/* Dispose handler for the calendar ecal */
+static void
+e_cal_dispose (GObject *object)
+{
+	ECal *ecal = E_CAL (object);
+
+	gdbus_cal_disconnect (ecal);
 
 	(* G_OBJECT_CLASS (parent_class)->dispose) (object);
 }



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]