mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2025-08-10 11:14:05 +02:00
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:
committed by
Edward Hervey
parent
e4c3af9d4e
commit
e3efbd30a2
@@ -270,8 +270,17 @@ value_free_string (GValue *value)
|
|||||||
static void
|
static void
|
||||||
value_copy_string (const GValue *src_value,
|
value_copy_string (const GValue *src_value,
|
||||||
GValue *dest_value)
|
GValue *dest_value)
|
||||||
|
{
|
||||||
|
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[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*
|
static gchar*
|
||||||
|
Reference in New Issue
Block a user