range: handle GtkAdjustment::changed at next frame

Open Christian Hergert requested to merge wip/chergert/fix-gizmo-warnings into main

GtkAdjustment have values that are often tied to the "virtual" allocation size of a widget, such as a GtkScrollable. Thusly, when size_allocate() is called on GtkScrollable, the adjustment will emit ::changed. But a size_allocate() indicates we're in the GDK_FRAME_CLOCK_PHASE_LAYOUT and that is too late to perform changes that will affect allocation.

Therefore, this defers handling of the changed signal to the next frame so that we do not perform operations that can cause widgets within the hierarchy to loose their allocation.

This fixes a very common issue, where we see something like:

Trying to snapshot GtkGizmo 0x... without a current allocation

which was caused by GtkViewport changing it's adjustment in size_allocate() and cascading to a GtkScrolledWindow->GtkScrollbar->GtkRange->GtkGizmo.

Merge request reports