From bc887fbbb23ee855fd26128ed143fe1c850e45cd Mon Sep 17 00:00:00 2001 From: Alx Sa Date: Tue, 20 May 2025 15:39:10 +0000 Subject: [PATCH] widgets: Prevent CRITICAL when toolbox has no child areas To balance the child areas in the toolbox horizontally, we dynamically set the maximum number of children in the GtkFlowBox depending on the number of visible ones. It is possible to hide all of them, giving us a max count of 0. However, gtk_flow_box_set_max_children_per_line () requires the max count to be at least 1 - this causes a CRITICAL. This patch adds a check to make sure the count is at least 1 before calling that function. --- app/widgets/gimptoolbox.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/app/widgets/gimptoolbox.c b/app/widgets/gimptoolbox.c index b159bebde0..74546c2562 100644 --- a/app/widgets/gimptoolbox.c +++ b/app/widgets/gimptoolbox.c @@ -868,7 +868,7 @@ toolbox_area_config_notify (GimpGuiConfig *config, visible_areas += (gint) config->toolbox_foo_area; visible_areas += (gint) config->toolbox_image_area; - gtk_flow_box_set_max_children_per_line (GTK_FLOW_BOX (area_box), - visible_areas); + if (visible_areas > 0) + gtk_flow_box_set_max_children_per_line (GTK_FLOW_BOX (area_box), + visible_areas); } -