[glade/gbinding: 22/60] Remove wrong g_assert(), and avoid another in the case of incorrect GtkBuilder files (thanks Juan!)



commit bfddd7773b4a1036dda8013c59a2e13869957000
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]