[glib/wip/gcleanup: 38/78] gparam: Reliably free class info initialization closure



commit 3fb0ddfbdbb6bbca820025b5508d2668cb37b13e
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 47f4e01..686e91b 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_PHASE (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]