From ff2617b0bd28e0c8b59c33f3990bb151970c557c Mon Sep 17 00:00:00 2001 From: Amadeus Folego Date: Wed, 28 Jan 2015 00:52:17 -0200 Subject: [PATCH] Fix crash when removing last channel Sometimes the last channel still had processing to do when it got deleted --- src/core/FxMixer.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/core/FxMixer.cpp b/src/core/FxMixer.cpp index 00143b2ee..5a2c8a272 100644 --- a/src/core/FxMixer.cpp +++ b/src/core/FxMixer.cpp @@ -529,7 +529,10 @@ FloatModel * FxMixer::channelSendModel( fx_ch_t fromChannel, fx_ch_t toChannel ) void FxMixer::mixToChannel( const sampleFrame * _buf, fx_ch_t _ch ) { - if( m_fxChannels[_ch]->m_muteModel.value() == false ) + // The first check is for the case where the last fxchannel was deleted but + // there was a race condition where it had to be processed. + if( _ch < m_fxChannels.size() && + m_fxChannels[_ch]->m_muteModel.value() == false ) { m_fxChannels[_ch]->m_lock.lock(); MixHelpers::add( m_fxChannels[_ch]->m_buffer, _buf, Engine::mixer()->framesPerPeriod() );