[gimp] app: don't use g_free() as key_destroy_func in a GType-keyed hash table



commit bbde1c48bde84f9ec1321988c490b1eea44a3c43
Author: Michael Natterer <mitch gimp org>
Date:   Tue Dec 23 01:15:10 2014 +0100

    app: don't use g_free() as key_destroy_func in a GType-keyed hash table
    
    This would have crashed if we ever replaced or removed something in
    that hash table. Instead, use g_object_unref() as value_destroy_func
    because the table keeps GimpContainers which we would leak if we ever
    removed anything from the table.

 app/gegl/gimp-gegl-config-proxy.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)
---
diff --git a/app/gegl/gimp-gegl-config-proxy.c b/app/gegl/gimp-gegl-config-proxy.c
index 4981a7c..d2cb8b6 100644
--- a/app/gegl/gimp-gegl-config-proxy.c
+++ b/app/gegl/gimp-gegl-config-proxy.c
@@ -267,8 +267,8 @@ gimp_gegl_get_config_container (GType config_type)
   if (! config_containers)
     config_containers = g_hash_table_new_full (g_direct_hash,
                                                g_direct_equal,
-                                               (GDestroyNotify) g_free,
-                                               NULL);
+                                               NULL,
+                                               (GDestroyNotify) g_object_unref);
 
   container = g_hash_table_lookup (config_containers, (gpointer) config_type);
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]