[gtk/a11y-crash: 2/2] a11y: Don't do unnecessary work
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk/a11y-crash: 2/2] a11y: Don't do unnecessary work
- Date: Tue, 4 Aug 2020 15:04:48 +0000 (UTC)
commit f7eb5f8897abd1ca616bf5d63d1978a210f9ccaf
Author: Matthias Clasen <mclasen redhat com>
Date: Tue Aug 4 11:02:00 2020 -0400
a11y: Don't do unnecessary work
Only serialize all the attributes if we are actually
going to print them.
gtk/gtktestatcontext.c | 18 +++++++++---------
1 file changed, 9 insertions(+), 9 deletions(-)
---
diff --git a/gtk/gtktestatcontext.c b/gtk/gtktestatcontext.c
index ff0b6833fd..e1bf0f5d1d 100644
--- a/gtk/gtktestatcontext.c
+++ b/gtk/gtktestatcontext.c
@@ -49,16 +49,16 @@ gtk_test_at_context_state_change (GtkATContext *self,
GtkAccessibleAttributeSet *properties,
GtkAccessibleAttributeSet *relations)
{
- char *states_str = gtk_accessible_attribute_set_to_string (states);
- char *properties_str = gtk_accessible_attribute_set_to_string (properties);
- char *relations_str = gtk_accessible_attribute_set_to_string (relations);
-
- GTK_NOTE(A11Y,
+ if (GTK_DEBUG_CHECK (A11Y))
{
+ char *states_str = gtk_accessible_attribute_set_to_string (states);
+ char *properties_str = gtk_accessible_attribute_set_to_string (properties);
+ char *relations_str = gtk_accessible_attribute_set_to_string (relations);
GtkAccessibleRole role = gtk_at_context_get_accessible_role (self);
GtkAccessible *accessible = gtk_at_context_get_accessible (self);
GEnumClass *class = g_type_class_ref (GTK_TYPE_ACCESSIBLE_ROLE);
GEnumValue *value = g_enum_get_value (class, role);
+
g_print ("*** Accessible state changed for accessible ā%sā, with role ā%sā (%d):\n"
"*** states = %s\n"
"*** properties = %s\n"
@@ -70,11 +70,11 @@ gtk_test_at_context_state_change (GtkATContext *self,
properties_str,
relations_str);
g_type_class_unref (class);
- });
- g_free (states_str);
- g_free (properties_str);
- g_free (relations_str);
+ g_free (states_str);
+ g_free (properties_str);
+ g_free (relations_str);
+ }
}
static void
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]