summaryrefslogtreecommitdiff
path: root/gio/gsettingsbackend.c
diff options
context:
space:
mode:
authorRyan Lortie <desrt@desrt.ca>2012-01-27 03:00:23 -0500
committerRyan Lortie <desrt@desrt.ca>2012-01-27 03:00:23 -0500
commitda386705f9e03ebf2cb9abbc523d84146b075444 (patch)
tree4a8f5002af5accce1b154541832dc17be04f356a /gio/gsettingsbackend.c
parent8e763aef43b951746662978c7c644365a92ecfa3 (diff)
GSettings: two memory use fixes
First, correct a rather dubious case of accessing a GSettingsSchemaKey after clearing it. This was technically okay because only the key name was accessed (and it is not owned by the struct) but it looks very wrong. Second, have g_settings_backend_write() sink the passed in GVariant*. Not all backends get this right, and I'm starting to like the pattern of virtual function wrappers being responsible for sinking the parameters that they are documented as consuming.
Diffstat (limited to 'gio/gsettingsbackend.c')
-rw-r--r--gio/gsettingsbackend.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/gio/gsettingsbackend.c b/gio/gsettingsbackend.c
index 6075d7fd0..f2f11eb5d 100644
--- a/gio/gsettingsbackend.c
+++ b/gio/gsettingsbackend.c
@@ -772,8 +772,14 @@ g_settings_backend_write (GSettingsBackend *backend,
GVariant *value,
gpointer origin_tag)
{
- return G_SETTINGS_BACKEND_GET_CLASS (backend)
+ gboolean success;
+
+ g_variant_ref_sink (value);
+ success = G_SETTINGS_BACKEND_GET_CLASS (backend)
->write (backend, key, value, origin_tag);
+ g_variant_unref (value);
+
+ return success;
}
/*< private >