gst/: Fix deserialisation from XML. Set parent manually instead of using gst_bin_add(), since gst_bin_add() will unli...

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.
This commit is contained in:
Tim-Philipp Müller 2006-06-30 13:17:46 +00:00
parent 3800e5ac9c
commit 565199efa8
3 changed files with 18 additions and 11 deletions

View file

@ -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>

View 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;
}

View 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);