[gtk/a11y/atspi] accessible: Avoid realizing the context prematurely



commit 2370429752e660458cdafddf78ad27512c2f3500
Author: Matthias Clasen <mclasen redhat com>
Date:   Wed Oct 14 00:16:23 2020 -0400

    accessible: Avoid realizing the context prematurely
    
    platform change is called from gtk_widget_set_focusable
    which is likely to be called early on in init(). We don't
    want to create an AT context that early if we can help
    it, e.g. since it makes it impossible to override the
    accessible-role with a construct property.

 gtk/gtkaccessible.c | 11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)
---
diff --git a/gtk/gtkaccessible.c b/gtk/gtkaccessible.c
index 1f3e2a3209..582cdf08fd 100644
--- a/gtk/gtkaccessible.c
+++ b/gtk/gtkaccessible.c
@@ -656,14 +656,17 @@ void
 gtk_accessible_platform_changed (GtkAccessible               *self,
                                  GtkAccessiblePlatformChange  change)
 {
-  GtkATContext *context = gtk_accessible_get_at_context (self);
+  GtkATContext *context;
+
+  if (GTK_IS_WIDGET (self) &&
+      gtk_widget_get_root (GTK_WIDGET (self)) == NULL)
+    return;
+
+  context = gtk_accessible_get_at_context (self);
 
   /* propagate changes up from ignored widgets */
   if (gtk_accessible_get_accessible_role (self) == GTK_ACCESSIBLE_ROLE_NONE)
     {
-      if (gtk_widget_get_parent (GTK_WIDGET (self)) == NULL)
-        return;
-
       context = gtk_accessible_get_at_context (GTK_ACCESSIBLE (gtk_widget_get_parent (GTK_WIDGET (self))));
     }
 


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