SampleTrack: call requestChangesInModel before unref SampleBuffer (#4982)

To avoid a race condition between the gui thread which destroys the
samplebuffer and the mixer thread which increases the buffer's ref-
count, we'll make sure to touch the ref-count only when wh're synced
with the mixer.
This commit is contained in:
Shmuel H
2019-05-27 21:26:30 +03:00
committed by GitHub
parent ec64de0723
commit 9c6e2278ce

View File

@@ -110,7 +110,9 @@ SampleTCO::~SampleTCO()
{
sampletrack->updateTcos();
}
Engine::mixer()->requestChangeInModel();
sharedObject::unref( m_sampleBuffer );
Engine::mixer()->doneChangeInModel();
}
@@ -133,7 +135,9 @@ const QString & SampleTCO::sampleFile() const
void SampleTCO::setSampleBuffer( SampleBuffer* sb )
{
Engine::mixer()->requestChangeInModel();
sharedObject::unref( m_sampleBuffer );
Engine::mixer()->doneChangeInModel();
m_sampleBuffer = sb;
updateLength();