From 3a8e1c55e1ff6cc507459f9fa5524d03fb9e192e Mon Sep 17 00:00:00 2001 From: Benjamin Otte Date: Sun, 7 Jul 2024 05:34:34 +0200 Subject: [PATCH] listitemfactory: Don't rebind on position or selection changes When the item doesn't change and only the position / selection state, then the signal list item factory should not emit bind + unbind signals. This used to work, but probably broke while refactoring for ColumnView during 4.10. This caused excessive rebinding when items got inserted at the top of a list instead of add the end. --- gtk/gtklistfactorywidget.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/gtk/gtklistfactorywidget.c b/gtk/gtklistfactorywidget.c index 335aeb85e9..8a27b65080 100644 --- a/gtk/gtklistfactorywidget.c +++ b/gtk/gtklistfactorywidget.c @@ -191,10 +191,12 @@ gtk_list_factory_widget_update (GtkListItemBase *base, if (priv->object) { + gpointer old_item = gtk_list_item_base_get_item (GTK_LIST_ITEM_BASE (self)); + gtk_list_item_factory_update (priv->factory, priv->object, - gtk_list_item_base_get_item (GTK_LIST_ITEM_BASE (self)) != NULL, - item != NULL, + item != old_item && old_item != NULL, + item != old_item && item != NULL, gtk_list_factory_widget_update_func, &update); }