mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-25 09:40:37 +00:00
ext/gconf/gstswitchsink.c: Fix up the dispose logic so it doesn't leak, and fix setting of the child state so that we...
Original commit message from CVS: * ext/gconf/gstswitchsink.c: (gst_switch_sink_dispose), (gst_switch_commit_new_kid): Fix up the dispose logic so it doesn't leak, and fix setting of the child state so that we don't set a child to our current state just as we are changing it to something else.
This commit is contained in:
parent
57145cecf3
commit
c71db98b91
2 changed files with 26 additions and 11 deletions
|
@ -1,3 +1,11 @@
|
|||
2007-03-06 Jan Schmidt <thaytan@mad.scientist.com>
|
||||
|
||||
* ext/gconf/gstswitchsink.c: (gst_switch_sink_dispose),
|
||||
(gst_switch_commit_new_kid):
|
||||
Fix up the dispose logic so it doesn't leak, and fix setting of
|
||||
the child state so that we don't set a child to our current state
|
||||
just as we are changing it to something else.
|
||||
|
||||
2007-03-06 Wim Taymans <wim@fluendo.com>
|
||||
|
||||
* gst/goom/gstgoom.c: (gst_goom_src_setcaps), (get_buffer),
|
||||
|
|
|
@ -100,19 +100,19 @@ static void
|
|||
gst_switch_sink_dispose (GObject * object)
|
||||
{
|
||||
GstSwitchSink *sink = GST_SWITCH_SINK (object);
|
||||
GstElement **p_kid;
|
||||
GstObject *new_kid, *kid;
|
||||
|
||||
GST_OBJECT_LOCK (sink);
|
||||
p_kid = &sink->new_kid;
|
||||
gst_object_replace ((GstObject **) p_kid, NULL);
|
||||
new_kid = GST_OBJECT_CAST (sink->new_kid);
|
||||
sink->new_kid = NULL;
|
||||
|
||||
if (sink->new_kid) {
|
||||
p_kid = &sink->kid;
|
||||
gst_element_set_state (sink->kid, GST_STATE_NULL);
|
||||
gst_object_replace ((GstObject **) p_kid, NULL);
|
||||
}
|
||||
kid = GST_OBJECT_CAST (sink->kid);
|
||||
sink->kid = NULL;
|
||||
GST_OBJECT_UNLOCK (sink);
|
||||
|
||||
gst_object_replace (&new_kid, NULL);
|
||||
gst_object_replace (&kid, NULL);
|
||||
|
||||
GST_CALL_PARENT (G_OBJECT_CLASS, dispose, (object));
|
||||
}
|
||||
|
||||
|
@ -120,13 +120,20 @@ gboolean
|
|||
gst_switch_commit_new_kid (GstSwitchSink * sink)
|
||||
{
|
||||
GstPad *targetpad;
|
||||
GstState cur_state;
|
||||
GstState kid_state;
|
||||
GstElement *new_kid, *old_kid;
|
||||
gboolean is_fakesink = FALSE;
|
||||
|
||||
/* need locking around member accesses */
|
||||
GST_OBJECT_LOCK (sink);
|
||||
cur_state = GST_STATE (sink);
|
||||
/* If we're currently changing state, set the child to the next state
|
||||
* we're transitioning too, rather than our current state which is
|
||||
* about to change */
|
||||
if (GST_STATE_NEXT (sink) != GST_STATE_VOID_PENDING)
|
||||
kid_state = GST_STATE_NEXT (sink);
|
||||
else
|
||||
kid_state = GST_STATE (sink);
|
||||
|
||||
new_kid = sink->new_kid;
|
||||
sink->new_kid = NULL;
|
||||
GST_OBJECT_UNLOCK (sink);
|
||||
|
@ -143,7 +150,7 @@ gst_switch_commit_new_kid (GstSwitchSink * sink)
|
|||
GST_DEBUG_OBJECT (sink, "Setting new kid");
|
||||
}
|
||||
|
||||
if (gst_element_set_state (new_kid, cur_state) == GST_STATE_CHANGE_FAILURE) {
|
||||
if (gst_element_set_state (new_kid, kid_state) == GST_STATE_CHANGE_FAILURE) {
|
||||
GST_ELEMENT_ERROR (sink, CORE, STATE_CHANGE, (NULL),
|
||||
("Failed to set state on new child."));
|
||||
gst_object_unref (new_kid);
|
||||
|
|
Loading…
Reference in a new issue