[glib] GSettingsBackend: allow floating refs from read()
- From: Ryan Lortie <ryanl src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [glib] GSettingsBackend: allow floating refs from read()
- Date: Thu, 22 Dec 2011 05:25:00 +0000 (UTC)
commit 6e7da987b443c861946a7702d64f9e50150b9320
Author: Ryan Lortie <desrt desrt ca>
Date: Thu Dec 22 00:24:20 2011 -0500
GSettingsBackend: allow floating refs from read()
Use g_variant_take_ref() to allow for backends to return floating
GVariant instances from their read() implementations.
gio/gsettingsbackend.c | 3 +++
1 files changed, 3 insertions(+), 0 deletions(-)
---
diff --git a/gio/gsettingsbackend.c b/gio/gsettingsbackend.c
index 6ea88d2..6075d7f 100644
--- a/gio/gsettingsbackend.c
+++ b/gio/gsettingsbackend.c
@@ -733,6 +733,9 @@ g_settings_backend_read (GSettingsBackend *backend,
value = G_SETTINGS_BACKEND_GET_CLASS (backend)
->read (backend, key, expected_type, default_value);
+ if (value != NULL)
+ value = g_variant_take_ref (value);
+
if G_UNLIKELY (value && !g_variant_is_of_type (value, expected_type))
{
g_variant_unref (value);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]