[gtk+] Plug a leak
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+] Plug a leak
- Date: Mon, 7 Sep 2015 07:19:26 +0000 (UTC)
commit 4dc47c37145509d63482f11a39ec0bab559421c1
Author: Matthias Clasen <mclasen redhat com>
Date: Sun Sep 6 19:16:43 2015 -0400
Plug a leak
A type class reference gotten with g_type_class_ref must be released
with g_type_class_unref, or else we leak.
gtk/gtkcsswidgetnode.c | 11 +++++++++--
1 files changed, 9 insertions(+), 2 deletions(-)
---
diff --git a/gtk/gtkcsswidgetnode.c b/gtk/gtkcsswidgetnode.c
index 4e67b51..f579c12 100644
--- a/gtk/gtkcsswidgetnode.c
+++ b/gtk/gtkcsswidgetnode.c
@@ -145,6 +145,7 @@ static gboolean
widget_needs_widget_path (GtkWidget *widget)
{
static GetPathForChildFunc funcs[2];
+ GtkContainerClass *class;
GtkWidget *parent;
GetPathForChildFunc parent_func;
guint i;
@@ -152,8 +153,14 @@ widget_needs_widget_path (GtkWidget *widget)
if (G_UNLIKELY (funcs[0] == NULL))
{
i = 0;
- funcs[i++] = GTK_CONTAINER_CLASS (g_type_class_ref (GTK_TYPE_CONTAINER))->get_path_for_child;
- funcs[i++] = GTK_CONTAINER_CLASS (g_type_class_ref (GTK_TYPE_BOX))->get_path_for_child;
+
+ class = (GtkContainerClass*)g_type_class_ref (GTK_TYPE_CONTAINER);
+ funcs[i++] = class->get_path_for_child;
+ g_type_class_unref (class);
+
+ class = (GtkContainerClass*)g_type_class_ref (GTK_TYPE_BOX);
+ funcs[i++] = class->get_path_for_child;
+ g_type_class_unref (class);
g_assert (i == G_N_ELEMENTS (funcs));
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]