kopia lustrzana https://github.com/jameshball/osci-render
Prevent setting toggle state after object deletion
rodzic
bed8997a2a
commit
f160c67f9f
|
@ -5,6 +5,10 @@
|
|||
|
||||
EffectsListComponent::EffectsListComponent(DraggableListBox& lb, AudioEffectListBoxItemData& data, int rn, Effect& effect) : DraggableListBoxItem(lb, data, rn),
|
||||
effect(effect), audioProcessor(data.audioProcessor), editor(data.editor) {
|
||||
if (effect.enabled == nullptr) {
|
||||
DBG("Effect enabled is null");
|
||||
}
|
||||
|
||||
auto parameters = effect.parameters;
|
||||
for (int i = 0; i < parameters.size(); i++) {
|
||||
std::shared_ptr<EffectComponent> effectComponent = std::make_shared<EffectComponent>(audioProcessor, effect, i);
|
||||
|
|
|
@ -77,8 +77,11 @@ public:
|
|||
}
|
||||
|
||||
void parameterValueChanged(int parameterIndex, float newValue) override {
|
||||
juce::MessageManager::callAsync([this]() {
|
||||
setToggleState(parameter->getBoolValue(), juce::NotificationType::dontSendNotification);
|
||||
juce::WeakReference<SwitchButton> weakThis = this;
|
||||
juce::MessageManager::callAsync([weakThis, this]() {
|
||||
if (weakThis != nullptr) {
|
||||
setToggleState(parameter->getBoolValue(), juce::NotificationType::dontSendNotification);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -174,6 +177,8 @@ private:
|
|||
bool prevToggleState = false;
|
||||
|
||||
BooleanParameter* parameter = nullptr;
|
||||
|
||||
JUCE_DECLARE_WEAK_REFERENCEABLE(SwitchButton)
|
||||
};
|
||||
|
||||
} // namespace jux
|
||||
|
|
Ładowanie…
Reference in New Issue