From af5fc77a240c3a36fe43277aeb759dd14d87953b Mon Sep 17 00:00:00 2001 From: Jacob Boerema Date: Wed, 5 Feb 2025 13:33:00 -0500 Subject: [PATCH] script-fu: fix crash when incorrectly using named parameters The array of strings representing the Scheme types wasn't updated after adding named parameters. This caused a crash when trying to use named parameters where that isn't possible. --- plug-ins/script-fu/libscriptfu/script-fu-errors.c | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/plug-ins/script-fu/libscriptfu/script-fu-errors.c b/plug-ins/script-fu/libscriptfu/script-fu-errors.c index a623297be1..c31b36860c 100644 --- a/plug-ins/script-fu/libscriptfu/script-fu-errors.c +++ b/plug-ins/script-fu/libscriptfu/script-fu-errors.c @@ -40,7 +40,7 @@ "T_STRING", "T_NUMBER", "T_SYMBOL", "T_PROC", "T_PAIR", "T_CLOSURE", "T_CONTINUATION", "T_FOREIGN", "T_CHARACTER", "T_PORT", "T_VECTOR", "T_MACRO", - "T_PROMISE", "T_ENVIRONMENT","T_ARRAY" + "T_PROMISE", "T_ENVIRONMENT","T_ARRAY", "T_ARG_SLOT" }; @@ -272,11 +272,18 @@ debug_in_arg (scheme *sc, const guint arg_index, const gchar *type_name ) { + pointer arg_val; + + if (sc->vptr->is_pair (a)) + arg_val = sc->vptr->pair_car (a); + else + arg_val = a; + g_debug ("param:%d, formal C type:%s, actual scheme type:%s (%d)", arg_index + 1, type_name, - ts_types[ type(sc->vptr->pair_car (a)) ], - type(sc->vptr->pair_car (a))); + ts_types[ type (arg_val) ], + type (arg_val)); } /* Log GValue: its value and its GType