mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-26 11:41:09 +00:00
gst/: Since remove is virtual in GstBin we must not assume the elements GList to have anothing usefull.
Original commit message from CVS: * gst/gstbin.c: (gst_bin_remove), (gst_bin_dispose): * gst/gstthread.c: (gst_thread_dispose), (gst_thread_catch), (gst_thread_main_loop): Since remove is virtual in GstBin we must not assume the elements GList to have anothing usefull. Add some more logging to GstThread and be a bit more paranoid when resetting the scheduler. Set the state of the bin to NULL before removing the children.
This commit is contained in:
parent
becad99a95
commit
31b478533c
3 changed files with 20 additions and 4 deletions
11
ChangeLog
11
ChangeLog
|
@ -1,3 +1,14 @@
|
|||
2004-07-09 Wim Taymans <wim@fluendo.com>
|
||||
|
||||
* gst/gstbin.c: (gst_bin_remove), (gst_bin_dispose):
|
||||
* gst/gstthread.c: (gst_thread_dispose), (gst_thread_catch),
|
||||
(gst_thread_main_loop):
|
||||
Since remove is virtual in GstBin we must not assume the
|
||||
elements GList to have anothing usefull.
|
||||
Add some more logging to GstThread and be a bit more paranoid
|
||||
when resetting the scheduler.
|
||||
Set the state of the bin to NULL before removing the children.
|
||||
|
||||
2004-07-09 Zaheer Abbas Merali <zaheerabbas at merali dot org>
|
||||
|
||||
* testsuite/threads/Makefile.am:
|
||||
|
|
|
@ -588,7 +588,6 @@ gst_bin_remove (GstBin * bin, GstElement * element)
|
|||
|
||||
g_return_if_fail (GST_IS_BIN (bin));
|
||||
g_return_if_fail (GST_IS_ELEMENT (element));
|
||||
g_return_if_fail (bin->children != NULL);
|
||||
|
||||
bclass = GST_BIN_GET_CLASS (bin);
|
||||
|
||||
|
@ -833,8 +832,7 @@ gst_bin_dispose (GObject * object)
|
|||
|
||||
GST_CAT_DEBUG_OBJECT (GST_CAT_REFCOUNTING, object, "dispose");
|
||||
|
||||
if (gst_element_get_state (GST_ELEMENT (object)) == GST_STATE_PLAYING)
|
||||
gst_element_set_state (GST_ELEMENT (object), GST_STATE_PAUSED);
|
||||
gst_element_set_state (GST_ELEMENT (object), GST_STATE_NULL);
|
||||
|
||||
while (bin->children) {
|
||||
gst_bin_remove (bin, GST_ELEMENT (bin->children->data));
|
||||
|
|
|
@ -223,6 +223,8 @@ gst_thread_dispose (GObject * object)
|
|||
|
||||
g_assert (GST_STATE (thread) == GST_STATE_NULL);
|
||||
|
||||
GST_CAT_DEBUG (GST_CAT_REFCOUNTING, "GstThread: dispose, freeing locks");
|
||||
|
||||
g_mutex_free (thread->lock);
|
||||
g_cond_free (thread->cond);
|
||||
|
||||
|
@ -369,12 +371,14 @@ gst_thread_catch (GstThread * thread)
|
|||
if (thread == gst_thread_get_current ()) {
|
||||
/* we're trying to catch ourself */
|
||||
if (!GST_FLAG_IS_SET (thread, GST_THREAD_MUTEX_LOCKED)) {
|
||||
GST_DEBUG_OBJECT (thread, "catching itself, grabbing lock");
|
||||
g_mutex_lock (thread->lock);
|
||||
GST_FLAG_SET (thread, GST_THREAD_MUTEX_LOCKED);
|
||||
}
|
||||
GST_DEBUG_OBJECT (thread, "catching itself");
|
||||
GST_FLAG_UNSET (thread, GST_THREAD_STATE_SPINNING);
|
||||
} else {
|
||||
GST_DEBUG_OBJECT (thread, "catching thread, grabbing lock");
|
||||
/* another thread is trying to catch us */
|
||||
g_mutex_lock (thread->lock);
|
||||
wait = !GST_FLAG_IS_SET (thread, GST_THREAD_STATE_SPINNING);
|
||||
|
@ -555,6 +559,7 @@ gst_thread_main_loop (void *arg)
|
|||
{
|
||||
GstThread *thread = NULL;
|
||||
gboolean status;
|
||||
GstScheduler *sched;
|
||||
|
||||
thread = GST_THREAD (arg);
|
||||
g_mutex_lock (thread->lock);
|
||||
|
@ -595,7 +600,9 @@ gst_thread_main_loop (void *arg)
|
|||
|
||||
/* we need to destroy the scheduler here because it has mapped it's
|
||||
* stack into the threads stack space */
|
||||
gst_scheduler_reset (GST_ELEMENT_SCHED (thread));
|
||||
sched = GST_ELEMENT_SCHED (thread);
|
||||
if (sched)
|
||||
gst_scheduler_reset (sched);
|
||||
|
||||
/* must do that before releasing the lock - we might get disposed before being done */
|
||||
g_signal_emit (G_OBJECT (thread), gst_thread_signals[SHUTDOWN], 0);
|
||||
|
|
Loading…
Reference in a new issue