[gimp] libgimpconfig: fix string deserialization for some cases



commit 2e6656599d2e79ee0c1545db044e21f313ee3ae5
Author: Michael Natterer <mitch gimp org>
Date:   Mon Jun 8 22:30:30 2020 +0200

    libgimpconfig: fix string deserialization for some cases
    
    In gimp_config_deserialize_fundamental(), we can't use
    g_value_set_static_string() because that will in the end pass the
    GScanner's temporary scanner->value.v_string to
    GObject::set_property(), and depending on set_property()'s
    implementation, we might not dup the string (for example objects
    created via gimp_config_type_register() will simply use g_value_copy()
    and end up with a dangling pointer as a string member).

 libgimpconfig/gimpconfig-deserialize.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
---
diff --git a/libgimpconfig/gimpconfig-deserialize.c b/libgimpconfig/gimpconfig-deserialize.c
index 2f3115a69a..ce5b8a6517 100644
--- a/libgimpconfig/gimpconfig-deserialize.c
+++ b/libgimpconfig/gimpconfig-deserialize.c
@@ -453,7 +453,7 @@ gimp_config_deserialize_fundamental (GValue     *value,
     {
     case G_TYPE_STRING:
       if (scanner_string_utf8_valid (scanner, prop_spec->name))
-        g_value_set_static_string (value, scanner->value.v_string);
+        g_value_set_string (value, scanner->value.v_string);
       else
         return G_TOKEN_NONE;
       break;


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]