[network-manager-applet] gconf: don't try to unset keys that don't exist; leak fixes



commit 696a872e8d0b7093458842a9896f4c03b1e356a9
Author: Dan Williams <dcbw redhat com>
Date:   Thu Sep 17 15:30:35 2009 -0700

    gconf: don't try to unset keys that don't exist; leak fixes
    
    gconf_client_all_entries() returns a caller-owned list, which we
    must free.  Trying to unset keys that don't exist emits change
    events even though nothing changed, which is noise we don't want.

 src/gconf-helpers/gconf-upgrade.c |   18 +++++++++++++++---
 1 files changed, 15 insertions(+), 3 deletions(-)
---
diff --git a/src/gconf-helpers/gconf-upgrade.c b/src/gconf-helpers/gconf-upgrade.c
index 9c87fbd..52f2a14 100644
--- a/src/gconf-helpers/gconf-upgrade.c
+++ b/src/gconf-helpers/gconf-upgrade.c
@@ -869,10 +869,16 @@ unset_one_setting_property (GConfClient *client,
                             const char *setting,
                             const char *key)
 {
+	GConfValue *val;
 	char *path;
 
 	path = g_strdup_printf ("%s/%s/%s", dir, setting, key);
-	gconf_client_unset (client, path, NULL);
+	val = gconf_client_get_without_default (client, path, NULL);
+	if (val) {
+		if (val->type != GCONF_VALUE_INVALID)
+			gconf_client_unset (client, path, NULL);
+		gconf_value_free (val);
+	}
 	g_free (path);
 }
 
@@ -1464,10 +1470,16 @@ nm_gconf_migrate_0_7_vpn_properties (GConfClient *client)
 
 		next:
 			g_free (key_name);
+			gconf_entry_unref (entry);
+		}
+
+		if (properties) {
+			g_slist_free (properties);
+
+			/* delete old vpn-properties dir */
+			gconf_client_recursive_unset (client, path, 0, NULL);
 		}
 
-		/* delete old vpn-properties dir */
-		gconf_client_recursive_unset (client, path, 0, NULL);
 		g_free (path);
 	}
 	nm_utils_slist_free (connections, g_free);



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