Issue #12100: Fix infinite loop on appending invalid input
This patch attempts to resolve issue #12100 (closed).
@Jehan Hi! This patch fixes the infinite loop, but I'm not sure if it's the implementation you'd prefer.
Basically, typing invalid input at the end of a number in GimpSizeEntry (like "2001w") causes gimp_size_entry_eevl_unit_resolver ()
to get stuck in an infinite loop when checking for a matching GimpUnit. The loops runs as long as unit != NULL
, but I don't think gimp_unit_get_by_id ()
returns NULL. In https://gitlab.gnome.org/GNOME/gimp/-/blob/master/libgimp/tests/test-unit.c#L75, you checked if GIMP_IS_UNIT (unit)
instead. I replaced the NULL check with a GIMP_IS_UNIT ()
check, and also had the 'i' variable skip to GIMP_UNIT_PERCENT
so it didn't constantly reset the unit back to gimp_unit_percent ()
.
Let me know if this works, or if you'd like that handled differently.