diff options
author | Timm Bäder <mail@baedert.org> | 2021-01-09 15:07:21 +0100 |
---|---|---|
committer | Timm Bäder <mail@baedert.org> | 2021-01-17 04:39:26 +0100 |
commit | b1c8613dbe013dfcc48506128304defd56a71fef (patch) | |
tree | 5dd6ae189a807b6898593f0cda9dcdca9314757c | |
parent | de6cd4f0d24a2e38b94fdb363f254e713cf0db2e (diff) | |
download | gtk+-b1c8613dbe013dfcc48506128304defd56a71fef.tar.gz |
accessible: Fix memory leak if context is unset
Unref the acessible values
-rw-r--r-- | gtk/gtkaccessible.c | 12 |
1 files 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); } /** |