Commit f96a0d5b authored by Hugo Beauzee-Luyssen's avatar Hugo Beauzee-Luyssen

Resolved potential race condition when moving slider along while rendering.

parent 67f2b35b
......@@ -117,9 +117,9 @@ void ClipWorkflow::unlock( ClipWorkflow* cw )
//Signal that render has been completed.
cw->m_renderWaitCond->wake();
// qDebug() << "Entering condwait";
qDebug() << "Entering condwait";
cw->m_waitCond->wait( cw->m_condMutex );
// qDebug() << "Leaved condwait";
qDebug() << "Leaved condwait";
cw->m_stateLock->lockForWrite();
cw->m_state = Rendering;
// {
......
......@@ -191,31 +191,42 @@ void TrackWorkflow::stopClipWorkflow( ClipWorkflow* cw )
cw->getState() == ClipWorkflow::Ready ||
cw->getState() == ClipWorkflow::EndReached )
{
qDebug() << "Stopping a sleeping / ready / endreached clip. Status == " << cw->getState();
cw->getStateLock()->unlock();
cw->queryStateChange( ClipWorkflow::Stopping );
cw->wake();
cw->stop();
qDebug() << "Stopping sleeping/ready/endreached clip";
}
else if ( cw->getState() == ClipWorkflow::Rendering )
{
qDebug() << "Stopping a rendering clipworkflow";
cw->getStateLock()->unlock();
cw->waitForCompleteRender();
cw->queryStateChange( ClipWorkflow::Stopping );
{
QMutexLocker lock( cw->getSleepMutex() );
cw->queryStateChange( ClipWorkflow::Stopping );
}
cw->wake();
cw->stop();
qDebug() << "Stopped rendering clipworkflow";
}
else if ( cw->getState() == ClipWorkflow::Initializing )
{
qDebug() << "Stopping an Initializing clipworkflow";
cw->getStateLock()->unlock();
cw->waitForCompleteInit();
cw->stop();
qDebug() << "Stopped Initializing clipworkflow";
}
else if ( cw->getState() == ClipWorkflow::Paused )
{
qDebug() << "Stopping a paused clipworkflow";
cw->getStateLock()->unlock();
cw->queryStateChange( ClipWorkflow::Stopping );
cw->unpause();
cw->stop();
qDebug() << "Stopped a paused clipworkflow";
}
else
{
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment