From 1ab3cb6e6239573427f70c07b2df19ce7a7144b5 Mon Sep 17 00:00:00 2001 From: be_ Date: Thu, 4 Jan 2018 17:48:12 -0600 Subject: [PATCH] fix crash enabling PFL after an EffectState is deleted --- src/engine/effects/engineeffect.cpp | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/engine/effects/engineeffect.cpp b/src/engine/effects/engineeffect.cpp index 5475a0b13b2b..833bfd4c7c05 100644 --- a/src/engine/effects/engineeffect.cpp +++ b/src/engine/effects/engineeffect.cpp @@ -72,6 +72,17 @@ void EngineEffect::loadStatesForInputChannel(const ChannelHandle* inputChannel, // Called from the main thread for garbage collection after an input channel is disabled void EngineEffect::deleteStatesForInputChannel(const ChannelHandle* inputChannel) { m_pProcessor->deleteStatesForInputChannel(inputChannel); + // If an output channel is not presently being processed, for example when + // PFL is not active, then EngineEffect::process cannot be relied upon to + // set the EffectEnableState from Disabling to Disabled. This must be done + // before the next time EngineEffect::process is called for that output + // channel, otherwise the EffectEnableState will still be in the intermediate + // Disabling state and EffectProcessorImpl::processChannel will try to run + // with an EffectState that has already been deleted and cause a crash. + // Refer to https://bugs.launchpad.net/mixxx/+bug/1741213 + for (EffectEnableState& effectState : m_effectEnableStateForChannelMatrix[*inputChannel]) { + effectState = EffectEnableState::Disabled; + } } bool EngineEffect::processEffectsRequest(EffectsRequest& message,