From: Benjamin Otte Date: Thu, 20 Apr 2023 17:07:08 +0000 (+0200) Subject: listbase: Don't warn on scroll in empty list X-Git-Tag: archive/raspbian/4.12.3+ds-1+rpi1~1^2^2^2~22^2~1^2~389^2 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=f393f70e;p=gtk4.git listbase: Don't warn on scroll in empty list Empty lists can still be scrolled if the scroll happens in the same frame as the emptying of the list. Related: #5763 --- diff --git a/gtk/gtklistbase.c b/gtk/gtklistbase.c index 0c7df53aa0..0a7dbb0b02 100644 --- a/gtk/gtklistbase.c +++ b/gtk/gtklistbase.c @@ -214,6 +214,11 @@ gtk_list_base_adjustment_value_changed_cb (GtkAdjustment *adjustment, &pos, &cell_area)) { + /* If we get here with n-items == 0, then somebody cleared the list but + * GC hasn't run. So no item to be found. */ + if (gtk_list_base_get_n_items (self) == 0) + return; + g_warning ("%s failed to scroll to given position. Ignoring...", G_OBJECT_TYPE_NAME (self)); return; }