gvalue: Static strings should not be copied

When doing copies of GValue backed by static strings, the contents should not be copied
This commit is contained in:
Edward Hervey 2020-05-15 17:28:45 +02:00 committed by Edward Hervey
parent e4c3af9d4e
commit e3efbd30a2

View File

@ -271,7 +271,16 @@ static void
value_copy_string (const GValue *src_value,
GValue *dest_value)
{
dest_value->data[0].v_pointer = g_strdup (src_value->data[0].v_pointer);
if (src_value->data[1].v_uint & G_VALUE_NOCOPY_CONTENTS)
{
dest_value->data[0].v_pointer = src_value->data[0].v_pointer;
dest_value->data[1].v_uint = src_value->data[1].v_uint;
}
else
{
dest_value->data[0].v_pointer = g_strdup (src_value->data[0].v_pointer);
dest_value->data[1].v_uint = src_value->data[1].v_uint;
}
}
static gchar*