From: Matthias Clasen Date: Mon, 19 Jun 2023 15:47:59 +0000 (-0400) Subject: a11y: Only allow get_name/description when realized X-Git-Tag: archive/raspbian/4.12.3+ds-1+rpi1~1^2^2^2~22^2~1^2~125^2~4 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=a791f235e632283394cad8f9428d180ab2d8fc66;p=gtk4.git a11y: Only allow get_name/description when realized These functions rely on self->accessible_role being set, and that is only the case for realized contexts. In practice, this is not a problem. Contexts are realized before ATs can get their names or descriptions, and the inspector realizes contexts too, nowadays. The only place where this caused a hickup is the testsuite. --- diff --git a/gtk/gtkatcontext.c b/gtk/gtkatcontext.c index 6e1703f9b5..e033585338 100644 --- a/gtk/gtkatcontext.c +++ b/gtk/gtkatcontext.c @@ -1229,6 +1229,8 @@ gtk_at_context_get_text_accumulate (GtkATContext *self, { GtkAccessibleValue *value = NULL; + g_warn_if_fail (self->realized); + /* Step 2.A */ if (!is_ref) { @@ -1377,6 +1379,8 @@ gtk_at_context_get_text (GtkATContext *self, { GtkATContext *parent = NULL; + g_warn_if_fail (self->realized); + /* Step 1 */ if (gtk_accessible_role_get_naming (self->accessible_role) == GTK_ACCESSIBLE_NAME_PROHIBITED) return g_strdup ("");