libgimpwidgets: Fix infinite loop on appending invalid input

gimp_size_entry_eevl_unit_resolver () loops through all valid units
to find a match for user's inputted value in GimpSizeEntry.
It runs until gimp_unit_get_by_id () returns NULL, where it does a
final check on GIMP_UNIT_PERCENT.
Due to a small logic error, we kept setting the GimpUnit to
gimp_unit_percent () each time it was NULL, so the loop ran forever.
Per Jehan, this patch breaks the logic up so that we terminate the
loop once the percent check fails.
This commit is contained in:
Alx Sa 2024-10-02 23:21:05 +00:00
parent 3eed201368
commit ff1a92b81e
1 changed files with 5 additions and 2 deletions

View File

@ -1547,10 +1547,13 @@ gimp_size_entry_eevl_unit_resolver (const gchar *identifier,
return TRUE;
}
/* Hack to handle percent within the loop */
if (unit == gimp_unit_percent ())
break;
unit = gimp_unit_get_by_id (i++);
/* Hack to handle percent within the loop */
if (unit == NULL && unit != gimp_unit_percent ())
if (unit == NULL)
unit = gimp_unit_percent ();
}