[glib] Fix gsettings tool crash



commit 62939f5e45cd102313285ec13f90c3b4763e6ca8
Author: Milan Bouchet-Valat <nalimilan club fr>
Date:   Sat Jun 19 18:33:26 2010 +0200

    Fix gsettings tool crash
    
    When no path is provided for the schema, we have call
    g_settings_new() instead of g_settings_new_with_path()
    passing a NULL path.
    
    This was crashing the tool on start since an assertion was
    recently added to g_settings_new_with_path() to refuse NULL.

 gio/gsettings-tool.c |   10 ++++++++--
 1 files changed, 8 insertions(+), 2 deletions(-)
---
diff --git a/gio/gsettings-tool.c b/gio/gsettings-tool.c
index 3f7d478..7f07f4e 100644
--- a/gio/gsettings-tool.c
+++ b/gio/gsettings-tool.c
@@ -132,7 +132,10 @@ handle_get (gint   *argc,
   schema = (*argv)[1];
   key = (*argv)[2];
 
-  settings = g_settings_new_with_path (schema, path);
+  if (path)
+    settings = g_settings_new_with_path (schema, path);
+  else
+    settings = g_settings_new (schema);
 
   v = g_settings_get_value (settings, key);
   g_print ("%s\n", g_variant_print (v, FALSE));
@@ -193,7 +196,10 @@ handle_set (gint   *argc,
   key = (*argv)[2];
   value = (*argv)[3];
 
-  settings = g_settings_new_with_path (schema, path);
+  if (path)
+    settings = g_settings_new_with_path (schema, path);
+  else
+    settings = g_settings_new (schema);
 
   v = g_settings_get_value (settings, key);
   type = g_variant_get_type (v);



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