widget: Reset alloc_needed_on_child before allocating children
authorIvan Molodetskikh <yalterz@gmail.com>
Mon, 27 Feb 2023 22:42:16 +0000 (14:42 -0800)
committerIvan Molodetskikh <yalterz@gmail.com>
Tue, 28 Feb 2023 05:38:42 +0000 (21:38 -0800)
commit75a417e33708dab2bdb2f784a8952e085a12bf03
tree4bc423550649fcd1b047761d8b66a2e4fad234f6
parentf6bd63c9ad70936ef0dbfd33853649ae4f6f35e8
widget: Reset alloc_needed_on_child before allocating children

Reset alloc_needed_on_child *before* allocating the children. This is
because some child's size_allocate() may call queue_allocate(), which
will bubble up alloc_needed_on_child. An example of this happening is
with GtkScrollable implementations, which are supposed to configure
their adjustments in size_allocate(), which will cause GtkScrollbar's
GtkRange to notice and queue_allocate() on itself.

If we reset alloc_needed_on_child after this happens, then our children
will have a lingering alloc_needed_on_child and will not receive an
allocation.

This commit fixes widgets occasionally losing an allocation when this
scenario happens.
gtk/gtkwidget.c