From ca931fbe33d0955d6d241dc90d3b375e45b28eb7 Mon Sep 17 00:00:00 2001 From: kaushik_B Date: Sun, 22 Feb 2026 14:07:40 +0530 Subject: [PATCH] Issue #14972: Fix GimpLabelSpin CRITICAL warnings for small double ranges During instantiation, the widget bypassed saving the PROP_DIGITS state because the spinbutton was not populated, leaving digits at 0. This forced the widget into an integer state, causing step calculations to break for small fractional ranges (e.g., 0.001 to 1.0). Added G_PARAM_CONSTRUCT to the digits property and moved the internal assignment outside the spinbutton check so the correct initial state is saved immediately. Added a check to ensure step and page do not go out of range. --- libgimpwidgets/gimplabelspin.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/libgimpwidgets/gimplabelspin.c b/libgimpwidgets/gimplabelspin.c index fa5be40cfd..8a634beb51 100644 --- a/libgimpwidgets/gimplabelspin.c +++ b/libgimpwidgets/gimplabelspin.c @@ -167,7 +167,8 @@ gimp_label_spin_class_init (GimpLabelSpinClass *klass) g_param_spec_int ("digits", NULL, "The number of decimal places to display", -1, G_MAXINT, -1, - GIMP_PARAM_READWRITE)); + GIMP_PARAM_READWRITE | + G_PARAM_CONSTRUCT)); } static void @@ -241,9 +242,9 @@ gimp_label_spin_set_property (GObject *object, } break; case PROP_DIGITS: + priv->digits = g_value_get_int (value); if (priv->spinbutton) { - priv->digits = g_value_get_int (value); gimp_label_spin_update_settings (spin); } break; @@ -356,7 +357,9 @@ gimp_label_spin_update_settings (GimpLabelSpin *spin) if (adjust_step && digits == 0 && step < 1.0) { step = 1.0; - if (page < step) + if (step > upper-lower) + step = upper-lower; + if (page < step || page > upper-lower) page = step; }