mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2025-08-01 15:03:39 +02:00
gvalue: Do copy non-interned strings
The G_VALUE_NOCOPY_CONTENTS for strings can only be used when collecting them and not when copying them. Instead only avoid copies for strings that are interned. Fixes #2141
This commit is contained in:
committed by
Philip Withnall
parent
aa46b2405f
commit
e21ab81ce0
@@ -148,11 +148,11 @@ test_value_string (void)
|
||||
g_assert_cmpstr (str2, ==, static1);
|
||||
g_free (str2);
|
||||
|
||||
/* Copying a static string gvalue should *not* copy the contents */
|
||||
/* Copying a static string gvalue should *actually* copy the contents */
|
||||
g_value_init (©, G_TYPE_STRING);
|
||||
g_value_copy (&value, ©);
|
||||
copystr = g_value_get_string (©);
|
||||
g_assert_true (copystr == static1);
|
||||
g_assert_true (copystr != static1);
|
||||
g_value_unset (©);
|
||||
|
||||
/* Setting a new string should change the contents */
|
||||
|
Reference in New Issue
Block a user