+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:
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);
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));
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);
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);
{
GstThread *thread = NULL;
gboolean status;
+ GstScheduler *sched;
thread = GST_THREAD (arg);
g_mutex_lock (thread->lock);
/* 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);