From 5831b7ddcbbf78a7f6994f631eae0da3b3276ddc Mon Sep 17 00:00:00 2001 From: Jehan Date: Fri, 24 Oct 2025 01:32:44 +0200 Subject: [PATCH] =?UTF-8?q?libgimpconfig:=20better=20error=20message=20whe?= =?UTF-8?q?n=20a=20GObject=20property=20tries=20to=E2=80=A6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit … deserialize with a wrong or unknown type. The error message in issue #13787 was about trying to deserialize a GimpControllerMouse object as GimpControllerInfo's controller. Yet GimpControllerMouse was removed with commit 76ddf4421c so this was failing. With this change, such error would be more explicit, with an error saying: > Unknown object type: GimpControllerMouse … instead of: > unexpected character ')', expecting string constant (which was very confusing to the actual issue) --- libgimpconfig/gimpconfig-deserialize.c | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/libgimpconfig/gimpconfig-deserialize.c b/libgimpconfig/gimpconfig-deserialize.c index 9139fc604f..ad9968975a 100644 --- a/libgimpconfig/gimpconfig-deserialize.c +++ b/libgimpconfig/gimpconfig-deserialize.c @@ -764,10 +764,21 @@ gimp_config_deserialize_object (GValue *value, } type = g_type_from_name (type_name); - g_free (type_name); - if (! g_type_is_a (type, prop_spec->value_type)) - return G_TOKEN_STRING; + if (type == 0) + { + g_scanner_error (scanner, "Unknown object type: %s", type_name); + g_free (type_name); + return G_TOKEN_NONE; + } + else if (! g_type_is_a (type, prop_spec->value_type)) + { + g_scanner_error (scanner, "Invalid object type: %s", type_name); + g_free (type_name); + return G_TOKEN_NONE; + } + + g_free (type_name); } if (! prop_object)