Index: modules/other/gail/gailtreeview.c
===================================================================
--- modules/other/gail/gailtreeview.c	(revision 21537)
+++ modules/other/gail/gailtreeview.c	(working copy)
@@ -4584,7 +4584,10 @@
 {
   gint n_rows = 1;
 
-  count_rows (model, NULL, NULL, &n_rows, 0, G_MAXINT);
+  if (gtk_tree_model_get_flags (model) & GTK_TREE_MODEL_LIST_ONLY)
+    n_rows = gtk_tree_model_iter_n_children (model, NULL);
+  else
+    count_rows (model, NULL, NULL, &n_rows, 0, G_MAXINT);
 
   return n_rows;
 }
