[glib/wip/gproperty-2: 162/178] binding: Use hash table as a set



commit e49d890d185e536c2cb8490d64155577e0e5eb04
Author: Emmanuele Bassi <ebassi gnome org>
Date:   Thu May 16 22:34:55 2013 +0100

    binding: Use hash table as a set

 gobject/gbinding.c |    7 ++++---
 1 files changed, 4 insertions(+), 3 deletions(-)
---
diff --git a/gobject/gbinding.c b/gobject/gbinding.c
index fd152b9..6fc8474 100644
--- a/gobject/gbinding.c
+++ b/gobject/gbinding.c
@@ -210,10 +210,10 @@ add_binding_qdata (GObject  *gobject,
 
       g_object_set_qdata_full (gobject, quark_gbinding,
                                bindings,
-                               (GDestroyNotify) g_hash_table_destroy);
+                               (GDestroyNotify) g_hash_table_unref);
     }
 
-  g_hash_table_insert (bindings, binding, GUINT_TO_POINTER (1));
+  g_hash_table_add (bindings, binding);
 }
 
 static inline void
@@ -223,7 +223,8 @@ remove_binding_qdata (GObject  *gobject,
   GHashTable *bindings;
 
   bindings = g_object_get_qdata (gobject, quark_gbinding);
-  g_hash_table_remove (bindings, binding);
+  if (binding != NULL)
+    g_hash_table_remove (bindings, binding);
 }
 
 /* the basic assumption is that if either the source or the target


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