summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRyan Lortie <desrt@desrt.ca>2015-02-19 12:21:48 -0500
committerMatthias Clasen <mclasen@redhat.com>2016-07-16 22:26:43 -0400
commitca037538535c49a21f32a1cef35972892222e01e (patch)
treed6339e341fe44f9838e5c363a3e03dac22514373
parentfdd0ed197205b7ed382ae1caf60d918dc1e4d546 (diff)
downloadglib-ca037538535c49a21f32a1cef35972892222e01e.tar.gz
g_settings_reset(): add precondition checks
Ensure that @key is non-%NULL on g_settings_reset(). It turns out that using g_settings_reset() with %NULL key (although invalid as per the API documentation and not possible via bindings) accidentally produces the same effect as the _reset_all() API that we are about to add. Add the standard precondition checks to prevent that from happening. https://bugzilla.gnome.org/show_bug.cgi?id=744678
-rw-r--r--gio/gsettings.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/gio/gsettings.c b/gio/gsettings.c
index 3841b5436..3e2ae449f 100644
--- a/gio/gsettings.c
+++ b/gio/gsettings.c
@@ -2338,6 +2338,9 @@ g_settings_reset (GSettings *settings,
{
gchar *path;
+ g_return_if_fail (G_IS_SETTINGS (settings));
+ g_return_if_fail (key != NULL);
+
path = g_strconcat (settings->priv->path, key, NULL);
g_settings_backend_reset (settings->priv->backend, path, NULL);
g_free (path);