From: Benjamin Otte Date: Thu, 30 Mar 2023 06:29:32 +0000 (+0200) Subject: listbase: Clear any newly set adjustments X-Git-Tag: archive/raspbian/4.12.3+ds-1+rpi1~1^2^2^2~22^2~1^2~475^2 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=dbff49b5;p=gtk4.git listbase: Clear any newly set adjustments The scrolling code assumes the adjustment values are up to date or it crashes and before we've run size_allocate() we haven't update them. Fixes a crash in the gtk-demo scrollinfo that would set the adjustments with random values (via ScrolledWindow.set_child()) and then scroll in a tick callback right before the (first) size_allocate(). --- diff --git a/gtk/gtklistbase.c b/gtk/gtklistbase.c index c0e2448279..0c7df53aa0 100644 --- a/gtk/gtklistbase.c +++ b/gtk/gtklistbase.c @@ -731,6 +731,8 @@ gtk_list_base_set_adjustment (GtkListBase *self, if (adjustment == NULL) adjustment = gtk_adjustment_new (0.0, 0.0, 0.0, 0.0, 0.0, 0.0); + else + gtk_adjustment_configure (adjustment, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0); g_object_ref_sink (adjustment); gtk_list_base_clear_adjustment (self, orientation);