Merge pull request #1708 from badosu/fix-crash-when-removing-last-channel

Fix crash when removing last channel
This commit is contained in:
Tres Finocchiaro
2015-01-28 23:16:50 -05:00

View File

@@ -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() );