[glade/gbinding] Remove wrong g_assert(), and avoid another in the case of incorrect GtkBuilder files (thanks Juan!)
- From: Denis Washington <denisw src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [glade/gbinding] Remove wrong g_assert(), and avoid another in the case of incorrect GtkBuilder files (thanks Juan!)
- Date: Fri, 10 Jun 2011 12:54:26 +0000 (UTC)
commit 8217795e9c8995724ba7067673f728af76f57619
Author: Denis Washington <denisw src gnome org>
Date: Fri Jun 10 14:48:42 2011 +0200
Remove wrong g_assert(), and avoid another in the case of incorrect GtkBuilder files (thanks Juan!)
gladeui/glade-binding.c | 21 ++++++++++++---------
1 files changed, 12 insertions(+), 9 deletions(-)
---
diff --git a/gladeui/glade-binding.c b/gladeui/glade-binding.c
index 8513df8..69f6845 100644
--- a/gladeui/glade-binding.c
+++ b/gladeui/glade-binding.c
@@ -236,7 +236,7 @@ glade_binding_set_source (GladeBinding *binding,
{
GladeBindingPrivate *priv;
- g_assert (GLADE_IS_BINDING (binding));
+ g_return_if_fail (GLADE_IS_BINDING (binding));
priv = GLADE_BINDING_GET_PRIVATE (binding);
@@ -285,14 +285,12 @@ glade_binding_read (GladeXmlNode *node,
source = glade_xml_get_property_string_required (node, GLADE_XML_TAG_SOURCE, NULL);
if (!to || !from || !source)
- {
- g_free (to);
- g_free (from);
- g_free (source);
- return NULL;
- }
+ goto error;
target = glade_widget_get_property (widget, to);
+ if (!target)
+ goto error;
+
binding = glade_binding_new (NULL, target);
/* We need to wait with resolving the source property until the complete
@@ -303,9 +301,14 @@ glade_binding_read (GladeXmlNode *node,
priv->source_object_name = source;
priv->source_property_name = from;
- g_free (to);
-
+ g_free (to);
return binding;
+
+ error:
+ g_free (to);
+ g_free (from);
+ g_free (source);
+ return NULL;
}
/**
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]