[glade/gbinding] Make glade_property_set_binding() accept NULL and prevent the binding from leaking
- From: Denis Washington <denisw src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [glade/gbinding] Make glade_property_set_binding() accept NULL and prevent the binding from leaking
- Date: Fri, 17 Jun 2011 18:37:20 +0000 (UTC)
commit 4a052589ee77462b0da83da4e350b16bff1ffe3a
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 adbbda5..63e905e 100644
--- a/gladeui/glade-property.c
+++ b/gladeui/glade-property.c
@@ -1576,11 +1576,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]