summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMilan Crha <mcrha@redhat.com>2011-01-27 13:35:52 +0100
committerDavid Woodhouse <David.Woodhouse@intel.com>2011-04-08 16:26:37 +0100
commit30d8144a673a991dd5dd9769fe8ac3de6c18f459 (patch)
treedb502e93ed8c763dbcfd746d8dbe185715443b50
parent9268d26b4a2c82eb7c6d86102e763c0b28e57f74 (diff)
downloadevolution-data-server-30d8144a673a991dd5dd9769fe8ac3de6c18f459.tar.gz
Bug #623933 - Crash under ESourceList::conf_changed_callback
(cherry picked from commit 07b4da9552be95f2da37c3ed5a87ee80cc5443fa)
-rw-r--r--libedataserver/e-source-list.c27
1 files changed, 13 insertions, 14 deletions
diff --git a/libedataserver/e-source-list.c b/libedataserver/e-source-list.c
index 6706e9639..8abdeccfe 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);