From 877a7f98caacbfbbd253f43cb05e5a8571cbb707 Mon Sep 17 00:00:00 2001 From: Emmanuele Bassi Date: Wed, 11 Nov 2020 18:09:43 +0000 Subject: [PATCH] a11y: Protect should_present() from empty contexts If the GtkAccessible implementation returns a NULL context, we should not be calling methods on it. --- gtk/gtkaccessible.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/gtk/gtkaccessible.c b/gtk/gtkaccessible.c index 13c4cb35ed..e9f8d7d663 100644 --- a/gtk/gtkaccessible.c +++ b/gtk/gtkaccessible.c @@ -678,9 +678,7 @@ gtk_accessible_platform_changed (GtkAccessible *self, /* propagate changes up from ignored widgets */ if (gtk_accessible_get_accessible_role (self) == GTK_ACCESSIBLE_ROLE_NONE) - { - context = gtk_accessible_get_at_context (GTK_ACCESSIBLE (gtk_widget_get_parent (GTK_WIDGET (self)))); - } + context = gtk_accessible_get_at_context (GTK_ACCESSIBLE (gtk_widget_get_parent (GTK_WIDGET (self)))); if (context == NULL) return; @@ -765,6 +763,9 @@ gtk_accessible_should_present (GtkAccessible *self) return FALSE; context = gtk_accessible_get_at_context (self); + if (context == NULL) + return FALSE; + if (gtk_at_context_has_accessible_state (context, GTK_ACCESSIBLE_STATE_HIDDEN)) { GtkAccessibleValue *value;