Commit ca037538 authored by Allison Karlitskaya's avatar Allison Karlitskaya Committed by Matthias Clasen

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.
parent fdd0ed19
...@@ -2338,6 +2338,9 @@ g_settings_reset (GSettings *settings, ...@@ -2338,6 +2338,9 @@ g_settings_reset (GSettings *settings,
{ {
gchar *path; gchar *path;
g_return_if_fail (G_IS_SETTINGS (settings));
g_return_if_fail (key != NULL);
path = g_strconcat (settings->priv->path, key, NULL); path = g_strconcat (settings->priv->path, key, NULL);
g_settings_backend_reset (settings->priv->backend, path, NULL); g_settings_backend_reset (settings->priv->backend, path, NULL);
g_free (path); g_free (path);
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment