ges-track: Set gnlobject state to NULL before disposing it

Work around a deadlock if setting state to NULL right before removing the
gnlobject from the composition.

https://bugzilla.gnome.org/show_bug.cgi?id=672751
This commit is contained in:
Volodymyr Rudyi 2012-03-28 02:53:50 +03:00 committed by Thibault Saunier
parent 9f6bbb8bab
commit 1dcb142307

View file

@ -302,7 +302,7 @@ ges_track_init (GESTrack * self)
*
* Creates a new #GESTrack with the given @type and @caps.
*
* The newly created track will steal a reference to the caps. If you wish to
* The newly created track will steal a reference to the caps. If you wish to
* use those caps elsewhere, you will have to take an extra reference.
*
* Returns: A new #GESTrack.
@ -552,10 +552,19 @@ ges_track_remove_object (GESTrack * track, GESTrackObject * object)
if ((gnlobject = ges_track_object_get_gnlobject (object))) {
GST_DEBUG ("Removing GnlObject '%s' from composition '%s'",
GST_ELEMENT_NAME (gnlobject), GST_ELEMENT_NAME (priv->composition));
/* We can't just set state of gnlobject to GST_STATE_NULL, because it will
* result in deadlock. Adding a ref to the gnlobj so we finalize it after
* removing it from the composition */
gst_object_ref (gnlobject);
if (!gst_bin_remove (GST_BIN (priv->composition), gnlobject)) {
GST_WARNING ("Failed to remove gnlobject from composition");
return FALSE;
}
gst_element_set_state (gnlobject, GST_STATE_NULL);
/* Wait for the state change to actually happen */
gst_element_get_state (gnlobject, NULL, NULL, GST_CLOCK_TIME_NONE);
gst_object_unref (gnlobject);
}
g_signal_handlers_disconnect_by_func (object, sort_track_objects_cb, NULL);