From 565199efa8ce3c80310361bf73e59dc982656193 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tim-Philipp=20M=C3=BCller?= Date: Fri, 30 Jun 2006 13:17:46 +0000 Subject: [PATCH] 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. --- ChangeLog | 9 +++++++++ gst/gstbin.c | 11 ++--------- gst/gstxml.c | 9 +++++++-- 3 files changed, 18 insertions(+), 11 deletions(-) diff --git a/ChangeLog b/ChangeLog index 8e81662dc1..86e25479e4 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,12 @@ +2006-06-30 Tim-Philipp Müller + + * 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 Patch by: Peter Kjellerstedt diff --git a/gst/gstbin.c b/gst/gstbin.c index 49296b7360..38c41b303f 100644 --- a/gst/gstbin.c +++ b/gst/gstbin.c @@ -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; } diff --git a/gst/gstxml.c b/gst/gstxml.c index 61ae6eeb26..292626ad03 100644 --- a/gst/gstxml.c +++ b/gst/gstxml.c @@ -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);