[glade/gbinding: 23/60] Make glade_property_set_binding() accept NULL and prevent the binding from leaking



commit 208f45fa136d4f9eeb7ee11e96fdb4072a22c3c7
Author: Denis Washington <denisw src gnome org>
Date:   Fri Jun 17 19:50:46 2011 +0200

    Make glade_property_set_binding() accept NULL and prevent the binding from leaking

 gladeui/glade-property.c |   11 ++++++++---
 1 files changed, 8 insertions(+), 3 deletions(-)
---
diff --git a/gladeui/glade-property.c b/gladeui/glade-property.c
index 5c80391..30a9c95 100644
--- a/gladeui/glade-property.c
+++ b/gladeui/glade-property.c
@@ -1575,11 +1575,16 @@ glade_property_set_binding (GladeProperty    *property,
                             GladeBinding     *binding)
 {
   g_return_if_fail (GLADE_IS_PROPERTY (property));
-  g_return_if_fail (GLADE_IS_BINDING (binding));
-  g_return_if_fail (glade_binding_get_target (binding) == property);
+  g_return_if_fail ((GLADE_IS_BINDING (binding)
+                     && glade_binding_get_target (binding) == property)
+                    || !binding);
+
+  if (property->priv->binding)
+    g_object_unref (property->priv->binding);
   
   property->priv->binding = binding;
-  g_object_ref (binding);
+  if (binding)
+    g_object_ref (binding);
 }
 
 static gint glade_property_su_stack = 0;



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