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.
This commit is contained in:
Wim Taymans 2009-05-25 11:56:47 +02:00
parent 9574d82bf9
commit d20de24c97

View file

@ -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);