mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2025-07-15 22:53:34 +02:00
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:
@ -2031,8 +2031,7 @@ class CodeGenerator:
|
||||
' value = _%s_skeleton_handle_get_property (g_dbus_interface_skeleton_get_connection (G_DBUS_INTERFACE_SKELETON (skeleton)), NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), "%s", info->name, NULL, skeleton);\n'
|
||||
' if (value != NULL)\n'
|
||||
' {\n'
|
||||
' if (g_variant_is_floating (value))\n'
|
||||
' g_variant_ref_sink (value);\n'
|
||||
' g_variant_take_ref (value);\n'
|
||||
' g_variant_builder_add (&builder, "{sv}", info->name, value);\n'
|
||||
' g_variant_unref (value);\n'
|
||||
' }\n'
|
||||
|
Reference in New Issue
Block a user