From ca7c90a99cfd27be8740497936f6a82f77ac922c Mon Sep 17 00:00:00 2001 From: Fastigium Date: Tue, 16 Feb 2016 13:31:17 +0100 Subject: [PATCH] Add mixer lock to EffectChain::clear to prevent a race condition --- src/core/EffectChain.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/core/EffectChain.cpp b/src/core/EffectChain.cpp index 5580ab14a..d3af38573 100644 --- a/src/core/EffectChain.cpp +++ b/src/core/EffectChain.cpp @@ -79,6 +79,8 @@ void EffectChain::loadSettings( const QDomElement & _this ) { clear(); + // TODO This method should probably also lock the mixer + m_enabledModel.setValue( _this.attribute( "enabled" ).toInt() ); const int plugin_cnt = _this.attribute( "numofeffects" ).toInt(); @@ -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(); }