diff options
author | Philip Withnall <withnall@endlessm.com> | 2019-01-23 15:15:53 +0000 |
---|---|---|
committer | Philip Withnall <withnall@endlessm.com> | 2019-01-30 14:41:15 +0000 |
commit | f829b65e518a82bd8cb350bb576bcfd6186c3064 (patch) | |
tree | ce1c4fc759a50e2adc056470dc70814e40b6c5b1 /gio/gsettings.c | |
parent | 9d89ed0c54c9c707a8aeb8c8aac0a0b0f4ab9194 (diff) | |
download | glib-f829b65e518a82bd8cb350bb576bcfd6186c3064.tar.gz |
gsettings: Clarify ownership transfer in a few places
I was trying to debug some memory leaks in the gsettings test.
Eventually, it seems that actually they’re caused by the
GMemorySettingsBackend being cached by GIOModule — so this commit makes
no functional changes. It should make the code and documentation a bit
clearer though.
Signed-off-by: Philip Withnall <withnall@endlessm.com>
Diffstat (limited to 'gio/gsettings.c')
-rw-r--r-- | gio/gsettings.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/gio/gsettings.c b/gio/gsettings.c index 2934f2b4b..dd8f94485 100644 --- a/gio/gsettings.c +++ b/gio/gsettings.c @@ -1137,6 +1137,8 @@ g_settings_new_full (GSettingsSchema *schema, } /* Internal read/write utilities {{{1 */ + +/* @value will be sunk */ static gboolean g_settings_write_to_backend (GSettings *settings, GSettingsSchemaKey *key, @@ -1417,7 +1419,7 @@ g_settings_set_enum (GSettings *settings, return FALSE; } - success = g_settings_write_to_backend (settings, &skey, variant); + success = g_settings_write_to_backend (settings, &skey, g_steal_pointer (&variant)); g_settings_schema_key_clear (&skey); return success; @@ -1528,7 +1530,7 @@ g_settings_set_flags (GSettings *settings, return FALSE; } - success = g_settings_write_to_backend (settings, &skey, variant); + success = g_settings_write_to_backend (settings, &skey, g_steal_pointer (&variant)); g_settings_schema_key_clear (&skey); return success; @@ -1672,7 +1674,7 @@ g_settings_set (GSettings *settings, value = g_variant_new_va (format, NULL, &ap); va_end (ap); - return g_settings_set_value (settings, key, value); + return g_settings_set_value (settings, key, g_steal_pointer (&value)); } /** |