[gconf-editor] 2009-04-21 Cosimo Cecchi <cosimoc gnome org>



commit 42dccca2de10735a2a68532fdf91ee2c5707acb6
Author: Cosimo Cecchi <cosimoc gnome org>
Date:   Tue Apr 21 22:54:15 2009 +0200

    2009-04-21  Cosimo Cecchi  <cosimoc gnome org>
    
    	* src/gconf-list-model.c (gconf_list_model_finalize),
    	(gconf_list_model_set_client):
    	* src/gconf-tree-model.c (gconf_tree_model_set_client):
    	Ref the GConfClient object when setting it to a model (#579751).
---
 ChangeLog              |    7 +++++++
 src/gconf-list-model.c |    8 ++++++--
 src/gconf-tree-model.c |    7 +++++--
 3 files changed, 18 insertions(+), 4 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index a0a7402..9865a90 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2009-04-21  Cosimo Cecchi  <cosimoc gnome org>
+
+	* src/gconf-list-model.c (gconf_list_model_finalize),
+	(gconf_list_model_set_client):
+	* src/gconf-tree-model.c (gconf_tree_model_set_client):
+	Ref the GConfClient object when setting it to a model (#579751).
+
 2009-03-17  Vincent Untz  <vuntz gnome org>
 
 	* configure.in: post-release bump to 2.26.1
diff --git a/src/gconf-list-model.c b/src/gconf-list-model.c
index 13d3035..74c7466 100644
--- a/src/gconf-list-model.c
+++ b/src/gconf-list-model.c
@@ -388,6 +388,7 @@ gconf_list_model_finalize (GObject *object)
 
         if (list_model->client) {
                 g_object_unref (list_model->client);
+		list_model->client = NULL;
         }
 
 	if (list_model->values) {
@@ -421,8 +422,11 @@ gconf_list_model_init (GConfListModel *model)
 void
 gconf_list_model_set_client (GConfListModel *model, GConfClient *client)
 {
-	g_object_unref (model->client);
-	model->client = client;
+	if (model->client != NULL) {
+		g_object_unref (model->client);
+	}
+
+	model->client = g_object_ref (client);
 }
 
 GtkTreeModel *
diff --git a/src/gconf-tree-model.c b/src/gconf-tree-model.c
index a7a2275..0e6e442 100644
--- a/src/gconf-tree-model.c
+++ b/src/gconf-tree-model.c
@@ -523,8 +523,11 @@ gconf_tree_model_init (GConfTreeModel *model)
 void
 gconf_tree_model_set_client (GConfTreeModel *model, GConfClient *client)
 {
-	g_object_unref (model->client);
-	model->client = client;
+	if (model->client != NULL) {
+		g_object_unref (model->client);
+	}
+
+	model->client = g_object_ref (client);
 }
 
 GtkTreeModel *



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