[glib/wip/gcleanup: 33/71] gparam: Reliably free class info initialization closure
- From: Stefan Walter <stefw src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [glib/wip/gcleanup: 33/71] gparam: Reliably free class info initialization closure
- Date: Wed, 13 Nov 2013 11:37:02 +0000 (UTC)
commit 2a73bed92a6b530d97e562690f36a00a097f2171
Author: Stef Walter <stefw gnome org>
Date: Thu Nov 7 22:54:07 2013 +0100
gparam: Reliably free class info initialization closure
Otherwise we end up in a strange leak where static types leak
unless their class has been ref'd.
https://bugzilla.gnome.org/show_bug.cgi?id=711778
gobject/gparam.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
---
diff --git a/gobject/gparam.c b/gobject/gparam.c
index 8a9a428..cd9528b 100644
--- a/gobject/gparam.c
+++ b/gobject/gparam.c
@@ -1369,7 +1369,6 @@ param_spec_generic_class_init (gpointer g_class,
if (info->value_validate)
class->value_validate = info->value_validate; /* optional */
class->values_cmp = info->values_cmp;
- g_free (class_data);
}
static void
@@ -1435,6 +1434,7 @@ g_param_type_register_static (const gchar *name,
cinfo->value_validate = pspec_info->value_validate;
cinfo->values_cmp = pspec_info->values_cmp ? pspec_info->values_cmp : default_values_cmp;
info.class_data = cinfo;
+ G_CLEANUP_IN (cinfo, g_free, G_CLEANUP_PHASE_GRAVEYARD);
return g_type_register_static (G_TYPE_PARAM, name, &info, 0);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]