Skip to content

clutter-box-layout: Use floats and assert on denormal numbers

distribute_natural_allocation expects an input >= 0 of type gint. In get_preferred_size_for_opposite_orientation it is used with an unchecked variable size of type gfloat, which in case it is Infinity, gets passed on in the macro MAX (0, size). Infinity becomes G_MININT when implicitly casted to gint in distribute_natural_allocation, triggering the assertion extra_space >= 0.

The resulting warning in the log is counter intuitive and not very helpful.

Use gfloat in distribute_natural_allocation instead of gint and assert on denormal values so we can more easily identify bugs.

Helps to find bugs like gnome-shell#892 (closed)

Edited by Robert Mader

Merge request reports