[gst-cvs] gstreamer: gsttask: avoid join to return early
Wim Taymans
wtay at kemper.freedesktop.org
Mon May 25 02:58:49 PDT 2009
Module: gstreamer
Branch: master
Commit: d20de24c97dbb55625939fa9c7a69d0dfa6fefeb
URL: http://cgit.freedesktop.org/gstreamer/gstreamer/commit/?id=d20de24c97dbb55625939fa9c7a69d0dfa6fefeb
Author: Wim Taymans <wim.taymans at collabora.co.uk>
Date: Mon May 25 11:56:47 2009 +0200
gsttask: avoid join to return early
Unset the running flag after we released the lock for posting the stream-status
message. If we set the running flag to FALSE too early, the join method will
just continue without waiting for the message to be posted, leading to potential
crashes.
---
gst/gsttask.c | 16 ++++++++--------
1 files changed, 8 insertions(+), 8 deletions(-)
diff --git a/gst/gsttask.c b/gst/gsttask.c
index cc01792..662a4f7 100644
--- a/gst/gsttask.c
+++ b/gst/gsttask.c
@@ -243,14 +243,6 @@ done:
task->abidata.ABI.thread = NULL;
exit:
- /* now we allow messing with the lock again by setting the running flag to
- * FALSE. Together with the SIGNAL this is the sign for the _join() to
- * complete.
- * Note that we still have not dropped the final ref on the task. We could
- * check here if there is a pending join() going on and drop the last ref
- * before releasing the lock as we can be sure that a ref is held by the
- * caller of the join(). */
- task->running = FALSE;
if (priv->thr_callbacks.leave_thread) {
/* fire the leave_thread callback when we need to. We need to do this before
* we signal the task and with the task lock released. */
@@ -262,6 +254,14 @@ exit:
* touch the priority when a custom callback has been installed. */
g_thread_set_priority (tself, G_THREAD_PRIORITY_NORMAL);
}
+ /* now we allow messing with the lock again by setting the running flag to
+ * FALSE. Together with the SIGNAL this is the sign for the _join() to
+ * complete.
+ * Note that we still have not dropped the final ref on the task. We could
+ * check here if there is a pending join() going on and drop the last ref
+ * before releasing the lock as we can be sure that a ref is held by the
+ * caller of the join(). */
+ task->running = FALSE;
GST_TASK_SIGNAL (task);
GST_OBJECT_UNLOCK (task);
More information about the Gstreamer-commits
mailing list