[gtk/wip/baedert/for-master: 28/35] accessible: Fix memory leak if context is unset
- From: Timm Bäder <baedert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk/wip/baedert/for-master: 28/35] accessible: Fix memory leak if context is unset
- Date: Mon, 11 Jan 2021 19:17:38 +0000 (UTC)
commit f773c4417285ca90ed3331be6935ecacf63ae41a
Author: Timm Bäder <mail baedert org>
Date: Sat Jan 9 15:07:21 2021 +0100
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);
}
/**
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]