[evolution-data-server/email-factory] Bug #623933 - Crash under ESourceList::conf_changed_callback (cherry picked from commit 07b4da9552be



commit 84b5b74755437082ae6f5160f351805161a06cc1
Author: Milan Crha <mcrha redhat com>
Date:   Thu Jan 27 13:35:52 2011 +0100

    Bug #623933 - Crash under ESourceList::conf_changed_callback
    (cherry picked from commit 07b4da9552be95f2da37c3ed5a87ee80cc5443fa)

 libedataserver/e-source-list.c |   27 +++++++++++++--------------
 1 files changed, 13 insertions(+), 14 deletions(-)
---
diff --git a/libedataserver/e-source-list.c b/libedataserver/e-source-list.c
index 6706e96..8abdecc 100644
--- a/libedataserver/e-source-list.c
+++ b/libedataserver/e-source-list.c
@@ -191,12 +191,14 @@ sync_idle_callback (ESourceList *list)
 {
 	GError *error = NULL;
 
+	g_object_ref (list);
 	if (!e_source_list_sync (list, &error)) {
 		g_warning ("Cannot update \"%s\": %s", list->priv->gconf_path, error ? error->message : "Unknown error");
 		g_error_free (error);
 	}
 
 	list->priv->sync_idle_id= 0;
+	g_object_unref (list);
 
 	return FALSE;
 }
@@ -205,11 +207,15 @@ static void
 group_changed_callback (ESourceGroup *group,
 			ESourceList *list)
 {
+	g_object_ref (list);
+
 	if (!list->priv->ignore_group_changed)
 		g_signal_emit (list, signals[CHANGED], 0);
 
 	if (list->priv->sync_idle_id == 0)
 		list->priv->sync_idle_id = g_idle_add ((GSourceFunc) sync_idle_callback, list);
+
+	g_object_unref (list);
 }
 
 static void
@@ -218,7 +224,9 @@ conf_changed_callback (GConfClient *client,
 		       GConfEntry *entry,
 		       ESourceList *list)
 {
+	g_object_ref (list);
 	load_from_gconf (list);
+	g_object_unref (list);
 }
 
 /* GObject methods.  */
@@ -230,6 +238,11 @@ impl_dispose (GObject *object)
 {
 	ESourceListPrivate *priv = E_SOURCE_LIST (object)->priv;
 
+	if (priv->gconf_client != NULL && priv->gconf_notify_id != 0) {
+		gconf_client_notify_remove (priv->gconf_client, priv->gconf_notify_id);
+		priv->gconf_notify_id = 0;
+	}
+
 	if (priv->sync_idle_id != 0) {
 		GError *error = NULL;
 
@@ -252,16 +265,8 @@ impl_dispose (GObject *object)
 	}
 
 	if (priv->gconf_client != NULL) {
-		if (priv->gconf_notify_id != 0) {
-			gconf_client_notify_remove (priv->gconf_client,
-						    priv->gconf_notify_id);
-			priv->gconf_notify_id = 0;
-		}
-
 		g_object_unref (priv->gconf_client);
 		priv->gconf_client = NULL;
-	} else {
-		g_assert_not_reached ();
 	}
 
 	(* G_OBJECT_CLASS (e_source_list_parent_class)->dispose) (object);
@@ -272,12 +277,6 @@ impl_finalize (GObject *object)
 {
 	ESourceListPrivate *priv = E_SOURCE_LIST (object)->priv;
 
-	if (priv->gconf_notify_id != 0) {
-		gconf_client_notify_remove (priv->gconf_client,
-					    priv->gconf_notify_id);
-		priv->gconf_notify_id = 0;
-	}
-
 	g_free (priv->gconf_path);
 	g_free (priv);
 



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