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.
This commit is contained in:
Alx Sa 2025-05-20 15:39:10 +00:00
parent 96d09108d5
commit bc887fbbb2

View file

@ -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);
}