Skip to content

Commit

Permalink
Add mixer lock to EffectChain::clear to prevent a race condition
Browse files Browse the repository at this point in the history
  • Loading branch information
Fastigium committed Jan 1, 2016
1 parent fb68a11 commit 23d2824
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/core/EffectChain.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,8 @@ void EffectChain::loadSettings( const QDomElement & _this )
{
clear();

// This method should probably also lock the mixer

m_enabledModel.setValue( _this.attribute( "enabled" ).toInt() );

const int plugin_cnt = _this.attribute( "numofeffects" ).toInt();
Expand Down Expand Up @@ -264,10 +266,14 @@ void EffectChain::clear()
{
emit aboutToClear();

Engine::mixer()->lock();

m_enabledModel.setValue( false );
for( int i = 0; i < m_effects.count(); ++i )
{
delete m_effects[i];
}
m_effects.clear();

Engine::mixer()->unlock();
}

0 comments on commit 23d2824

Please sign in to comment.