From b1c8613dbe013dfcc48506128304defd56a71fef Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Timm=20B=C3=A4der?= Date: Sat, 9 Jan 2021 15:07:21 +0100 Subject: [PATCH] accessible: Fix memory leak if context is unset Unref the acessible values --- gtk/gtkaccessible.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/gtk/gtkaccessible.c b/gtk/gtkaccessible.c index ed89fa9714..c5934c80f8 100644 --- a/gtk/gtkaccessible.c +++ b/gtk/gtkaccessible.c @@ -496,12 +496,12 @@ gtk_accessible_update_relation_value (GtkAccessible *self, GtkAccessibleRelation relations[], const GValue values[]) { + GtkATContext *context; + g_return_if_fail (GTK_IS_ACCESSIBLE (self)); g_return_if_fail (n_relations > 0); - GtkATContext *context = gtk_accessible_get_at_context (self); - if (context == NULL) - return; + context = gtk_accessible_get_at_context (self); for (int i = 0; i < n_relations; i++) { @@ -520,13 +520,15 @@ gtk_accessible_update_relation_value (GtkAccessible *self, break; } - gtk_at_context_set_accessible_relation (context, relation, real_value); + if (context) + gtk_at_context_set_accessible_relation (context, relation, real_value); if (real_value != NULL) gtk_accessible_value_unref (real_value); } - gtk_at_context_update (context); + if (context) + gtk_at_context_update (context); } /**