gst/: Fix deserialisation from XML. Set parent manually instead of using gst_bin_add...
authorTim-Philipp Müller <tim@centricular.net>
Fri, 30 Jun 2006 13:17:46 +0000 (13:17 +0000)
committerTim-Philipp Müller <tim@centricular.net>
Fri, 30 Jun 2006 13:17:46 +0000 (13:17 +0000)
Original commit message from CVS:
* gst/gstbin.c: (gst_bin_restore_thyself):
* gst/gstxml.c: (gst_xml_make_element):
Fix deserialisation from XML. Set parent manually
instead of using gst_bin_add(), since gst_bin_add()
will unlink all pads of the element being added.
Fixes #341667.

ChangeLog
gst/gstbin.c
gst/gstxml.c

index 8e81662..86e2547 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,12 @@
+2006-06-30  Tim-Philipp Müller  <tim at centricular dot net>
+
+       * gst/gstbin.c: (gst_bin_restore_thyself):
+       * gst/gstxml.c: (gst_xml_make_element):
+         Fix deserialisation from XML. Set parent manually
+         instead of using gst_bin_add(), since gst_bin_add()
+         will unlink all pads of the element being added.
+         Fixes #341667.
+
 2006-06-28  Tim-Philipp Müller  <tim at centricular dot net>
 
        Patch by: Peter Kjellerstedt <pkj at axis com>
index 49296b7..38c41b3 100644 (file)
@@ -2634,15 +2634,8 @@ gst_bin_restore_thyself (GstObject * object, xmlNodePtr self)
       childlist = field->xmlChildrenNode;
       while (childlist) {
         if (!strcmp ((char *) childlist->name, "element")) {
-          GstElement *element =
-              gst_xml_make_element (childlist, GST_OBJECT (bin));
-
-          /* it had to be parented to find the pads, now we ref and unparent so
-           * we can add it to the bin */
-          gst_object_ref (element);
-          gst_object_unparent (GST_OBJECT (element));
-
-          gst_bin_add (bin, element);
+          /* gst_xml_make_element will gst_bin_add() the element to ourself */
+          gst_xml_make_element (childlist, GST_OBJECT (bin));
         }
         childlist = childlist->next;
       }
index 61ae6ee..292626a 100644 (file)
@@ -450,8 +450,13 @@ gst_xml_make_element (xmlNodePtr cur, GstObject * parent)
 
   /* ne need to set the parent on this object bacause the pads */
   /* will go through the hierarchy to link to their peers */
-  if (parent)
-    gst_object_set_parent (GST_OBJECT (element), parent);
+  if (parent) {
+    if (GST_IS_BIN (parent)) {
+      gst_bin_add (GST_BIN (parent), element);
+    } else {
+      gst_object_set_parent (GST_OBJECT (element), parent);
+    }
+  }
 
   gst_object_restore_thyself (GST_OBJECT (element), cur);