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

Solved potential crash when moving a clip workflow from a track to another

parent 87e73d35
......@@ -320,6 +320,7 @@ void MainWorkflow::trackUnpaused()
void MainWorkflow::tracksRenderCompleted( unsigned int trackId )
{
qDebug() << "tracksRenderCompleted";
QMutexLocker lockNbTracks( m_nbTracksToRenderMutex );
--m_nbTracksToRender;
......@@ -337,6 +338,7 @@ void MainWorkflow::tracksRenderCompleted( unsigned int trackId )
//therefore, m_nbTracksToRender will be equal to -1
if ( m_nbTracksToRender <= 0 )
{
qDebug() << "main workflow render completed";
//Just a synchronisation barriere
{
QMutexLocker lock( m_synchroneRenderWaitConditionMutex );
......@@ -349,9 +351,9 @@ unsigned char* MainWorkflow::getSynchroneOutput()
{
m_synchroneRenderWaitConditionMutex->lock();
getOutput();
// qDebug() << "Waiting for sync output";
qDebug() << "Waiting for sync output";
m_synchroneRenderWaitCondition->wait( m_synchroneRenderWaitConditionMutex );
// qDebug() << "Got it";
qDebug() << "Got it";
m_synchroneRenderWaitConditionMutex->unlock();
if ( m_synchroneRenderingBuffer == NULL )
return MainWorkflow::blackOutput;
......
......@@ -421,6 +421,7 @@ Clip* TrackWorkflow::removeClip( const QUuid& id )
Clip* clip = cw->getClip();
m_clips.erase( it );
computeLength();
disconnectClipWorkflow( cw );
delete cw;
return clip;
}
......@@ -441,6 +442,7 @@ ClipWorkflow* TrackWorkflow::removeClipWorkflow( const QUuid& id )
if ( it.value()->getClip()->getUuid() == id )
{
ClipWorkflow* cw = it.value();
disconnectClipWorkflow( cw );
m_clips.erase( it );
computeLength();
return cw;
......@@ -453,6 +455,7 @@ ClipWorkflow* TrackWorkflow::removeClipWorkflow( const QUuid& id )
void TrackWorkflow::clipWorkflowRenderCompleted( ClipWorkflow* cw )
{
qDebug() << "Clip [" << QObject::sender() << "] render is completed on track" << m_trackId;
if ( cw != NULL )
{
m_synchroneRenderBuffer = cw->getOutput();
......@@ -466,8 +469,11 @@ void TrackWorkflow::clipWorkflowRenderCompleted( ClipWorkflow* cw )
//or equal to 0
if ( m_nbClipToRender <= 0 )
{
qDebug() << "Track render completed";
emit renderCompleted( m_trackId );
}
else
qDebug() << "Track render not completed yet";
}
unsigned char* TrackWorkflow::getSynchroneOutput()
......@@ -603,3 +609,10 @@ void TrackWorkflow::setFullSpeedRender( bool value )
++it;
}
}
void TrackWorkflow::disconnectClipWorkflow( ClipWorkflow* cw )
{
disconnect( cw, SIGNAL( renderComplete( ClipWorkflow* ) ), this, SLOT( clipWorkflowRenderCompleted( ClipWorkflow* ) ) );
disconnect( cw, SIGNAL( paused() ), this, SLOT( clipWorkflowPaused() ) );
disconnect( cw, SIGNAL( unpaused() ), this, SLOT( clipWorkflowUnpaused() ) );
}
......@@ -84,6 +84,7 @@ class TrackWorkflow : public QObject
void stopClipWorkflow( ClipWorkflow* cw );
bool checkEnd( qint64 currentFrame ) const;
void adjustClipTime( qint64 currentFrame, qint64 start, ClipWorkflow* cw );
void disconnectClipWorkflow( ClipWorkflow* cw );
private:
......
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