From ede124ff85d22151aa415224a3c233f68325521f Mon Sep 17 00:00:00 2001 From: Alx Sa Date: Fri, 15 Aug 2025 06:03:13 +0000 Subject: [PATCH] tools: Fix crash in passthrough composited preview Resolves #13087 We use gimp_layer_get_effective_mode () to retrieve a simplified layer mode for optimization purposes (e.g. if it's effectively NORMAL, we can do less processing). GimpTransformGridTool used this function when the user requests Composited Preview to only apply transforms to individual layers in a group if absolutely necessary. This means that sometimes, it returns NORMAL instead of PASS_THROUGH depending on the number and types of layers in the group. Since 71aff497, when we remove a filter we also update the effective mode of the group layer. However, this leads to an infinite loop scenario where the effective mode change causes the TransformGridTool to repeatedly remove and add a filter until GIMP crashes. This patch changes the gimp_transform_grid_tool_add_filter () check to always get the actual mode rather than the effective mode. This prevents the effective mode change from causing an infinite loop, but does mean that we now always apply transforms to all layers of the group even if the composite preview would work fine. --- app/tools/gimptransformgridtool.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/app/tools/gimptransformgridtool.c b/app/tools/gimptransformgridtool.c index a3731d29f9..303cce4ff3 100644 --- a/app/tools/gimptransformgridtool.c +++ b/app/tools/gimptransformgridtool.c @@ -1909,10 +1909,7 @@ gimp_transform_grid_tool_add_filter (GimpDrawable *drawable, GimpLayerMode mode = GIMP_LAYER_MODE_NORMAL; if (GIMP_IS_LAYER (drawable)) - { - gimp_layer_get_effective_mode (GIMP_LAYER (drawable), - &mode, NULL, NULL, NULL); - } + mode = gimp_layer_get_mode (GIMP_LAYER (drawable)); if (mode != GIMP_LAYER_MODE_PASS_THROUGH) {