[gtk/a11y/stackswitcher-tabs] atspi: Don't crash on unnamed stack pages



commit c676977cec35ee1e2b3735510656107b3004ad94
Author: Matthias Clasen <mclasen redhat com>
Date:   Wed Oct 14 19:05:36 2020 -0400

    atspi: Don't crash on unnamed stack pages
    
    GtkNotebook creates unnamed stack pages, and we should
    not crash when that happens.

 gtk/a11y/gtkatspicontext.c | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)
---
diff --git a/gtk/a11y/gtkatspicontext.c b/gtk/a11y/gtkatspicontext.c
index b6badc3beb..084c6a14be 100644
--- a/gtk/a11y/gtkatspicontext.c
+++ b/gtk/a11y/gtkatspicontext.c
@@ -568,9 +568,14 @@ handle_accessible_get_property (GDBusConnection       *connection,
       if (GTK_IS_WIDGET (accessible))
         res = g_variant_new_string (gtk_widget_get_name (GTK_WIDGET (accessible)));
       else if (GTK_IS_STACK_PAGE (accessible))
-        res = g_variant_new_string (gtk_stack_page_get_name (GTK_STACK_PAGE (accessible)));
+        {
+          const char *name = gtk_stack_page_get_name (GTK_STACK_PAGE (accessible));
+          if (name == NULL)
+             name = G_OBJECT_TYPE_NAME (accessible);
+          res = g_variant_new_string (name);
+        }
       else
-        res = g_variant_new_string ("Name");
+        res = g_variant_new_string (G_OBJECT_TYPE_NAME (accessible));
     }
   else if (g_strcmp0 (property_name, "Description") == 0)
     {


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]