From d6ddcb5b93683b23ddc5a7975361e8df1d07bac3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Luk=C3=A1=C5=A1=20Tyrychtr?= Date: Tue, 15 Oct 2024 14:25:14 +0200 Subject: [PATCH] a11y: Fix GtkListview's selection interface implementation When determining the number of selected children, we were properly counting only items, but in the rest, we were confused by row headers. Because the GtkListItemBase methods did not throw a warning on inappropriate pointer type passed, we happily passed the row headers, got some private data object as the wrong type, and then returned nonsense, for example, 2 for gtk_list_item_base_get_selected. --- gtk/a11y/gtkatspiselection.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/gtk/a11y/gtkatspiselection.c b/gtk/a11y/gtkatspiselection.c index 99a1bdf106..5c7215ec21 100644 --- a/gtk/a11y/gtkatspiselection.c +++ b/gtk/a11y/gtkatspiselection.c @@ -256,6 +256,8 @@ listview_handle_method (GDBusConnection *connection, child; child = gtk_widget_get_next_sibling (child)) { + if (!GTK_IS_LIST_ITEM_BASE (child)) + continue; if (gtk_list_item_base_get_selected (GTK_LIST_ITEM_BASE (child))) { if (idx == 0) @@ -288,6 +290,8 @@ listview_handle_method (GDBusConnection *connection, child; child = gtk_widget_get_next_sibling (child)) { + if (!GTK_IS_LIST_ITEM_BASE (child)) + continue; if (idx == 0) break; idx--; @@ -320,6 +324,8 @@ listview_handle_method (GDBusConnection *connection, child; child = gtk_widget_get_next_sibling (child)) { + if (!GTK_IS_LIST_ITEM_BASE (child)) + continue; if (idx == 0) break; idx--; @@ -353,6 +359,8 @@ listview_handle_method (GDBusConnection *connection, child; child = gtk_widget_get_next_sibling (child)) { + if (!GTK_IS_LIST_ITEM_BASE (child)) + continue; if (gtk_list_item_base_get_selected (GTK_LIST_ITEM_BASE (child))) { if (idx == 0) @@ -388,6 +396,8 @@ listview_handle_method (GDBusConnection *connection, child; child = gtk_widget_get_next_sibling (child)) { + if (!GTK_IS_LIST_ITEM_BASE (child)) + continue; if (idx == 0) break; idx--;