Commit 3b27d9d3 authored by Hugo Beauzee-Luyssen's avatar Hugo Beauzee-Luyssen
Browse files

Solved potential dead lock when stopping a clip.

parent ca6f47ca
......@@ -99,7 +99,9 @@ void ClipWorkflow::unlock( ClipWorkflow* cw )
cw->m_renderWaitCond->wake();
cw->emit renderComplete( cw );
qDebug() << "Entering cond wait";
cw->m_waitCond->wait( cw->m_condMutex );
qDebug() << "Leaving condwait";
cw->m_stateLock->lockForWrite();
if ( cw->m_state == Sleeping )
cw->m_state = Rendering;
......@@ -233,6 +235,7 @@ void ClipWorkflow::stop()
delete m_vlcMedia;
m_initFlag = false;
m_rendering = false;
qDebug() << "Clip workflow stopped";
}
else
qDebug() << "ClipWorkflow has already been stopped";
......
......@@ -216,12 +216,16 @@ void TrackWorkflow::stopClipWorkflow( ClipWorkflow* cw )
cw->getStateLock()->unlock();
return ;
}
qDebug() << "Stopping clip. state:" << cw->getState();
if ( cw->getState() == ClipWorkflow::Sleeping ||
cw->getState() == ClipWorkflow::Ready ||
cw->getState() == ClipWorkflow::EndReached )
{
cw->getStateLock()->unlock();
{
QMutexLocker lock( cw->getSleepMutex() );
cw->queryStateChange( ClipWorkflow::Stopping );
}
cw->wake();
cw->stop();
}
......
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