GVariant: add g_variant_take_ref()

This function implements the following logic:

  if (g_variant_is_floating (value))
    g_variant_ref_sink (value);

which is used for consuming the return value of callbacks that may or
may not return floating references.

This patch also replaces a few instances of the above code with the new
function (GSettings, GDBus) and lifts a long-standing restriction on the
use of floating values as the return value for signal handlers by
improving g_value_take_variant().

https://bugzilla.gnome.org/show_bug.cgi?id=627974
This commit is contained in:
Ryan Lortie
2011-07-11 14:27:53 +02:00
parent 2121e56ea7
commit 58c247e51b
8 changed files with 64 additions and 16 deletions

View File

@@ -2992,6 +2992,7 @@ g_variant_unref
g_variant_ref
g_variant_ref_sink
g_variant_is_floating
g_variant_take_ref
g_variant_get_type
g_variant_get_type_string
g_variant_is_of_type