mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2025-07-31 22:23:39 +02:00
gobject: Always ref-sink variants in g_object_set
When collecting varargs, ignore the NOCOPY_CONTENTS flag for variants. That is what our docs advice for refcounted types, and it fixes a regression that was inadvertendly introduced when we stopped doing some extra GValue copies. Includes a test case by Philip Withnall. Fixes: #2774
This commit is contained in:
committed by
Philip Withnall
parent
662661a8d0
commit
e79af74d1b
@@ -388,12 +388,8 @@ value_collect_variant (GValue *value,
|
||||
{
|
||||
if (!collect_values[0].v_pointer)
|
||||
value->data[0].v_pointer = NULL;
|
||||
else if (collect_flags & G_VALUE_NOCOPY_CONTENTS)
|
||||
{
|
||||
value->data[0].v_pointer = collect_values[0].v_pointer;
|
||||
value->data[1].v_uint = G_VALUE_NOCOPY_CONTENTS;
|
||||
}
|
||||
else
|
||||
/* never honour G_VALUE_NOCOPY_CONTENTS for ref-counted types */
|
||||
value->data[0].v_pointer = g_variant_ref_sink (collect_values[0].v_pointer);
|
||||
|
||||
return NULL;
|
||||
|
Reference in New Issue
Block a user