Skip to content

Commit

Permalink
Ensure parameter enable state is copied
Browse files Browse the repository at this point in the history
Fix crash when no input streams are available
  • Loading branch information
anjaldoshi committed Aug 30, 2023
1 parent 024691d commit de9fc58
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 6 deletions.
3 changes: 2 additions & 1 deletion Source/Processors/Parameter/Parameter.h
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,8 @@ class PLUGIN_API Parameter
currentValue(other.currentValue),
defaultValue(other.defaultValue),
previousValue(other.previousValue),
m_deactivateDuringAcquisition(other.m_deactivateDuringAcquisition)
m_deactivateDuringAcquisition(other.m_deactivateDuringAcquisition),
isEnabledFlag(other.isEnabledFlag)
{
parameterListeners.clear();
}
Expand Down
12 changes: 7 additions & 5 deletions Source/Processors/Parameter/ParameterEditor.h
Original file line number Diff line number Diff line change
Expand Up @@ -94,16 +94,18 @@ class PLUGIN_API ParameterEditor : public Component,
virtual void updateView() = 0;

/** Sets the parameter corresponding to this editor*/
void setParameter(Parameter* param_)
void setParameter(Parameter* newParam)
{
if(param != nullptr)
param->removeListener(this);

if(param_ != nullptr)
param_->addListener(this);
if(newParam != nullptr)
{
newParam->addListener(this);
setEnabled(newParam->isEnabled());
}

param = param_;
setEnabled(param->isEnabled());
param = newParam;
updateView();
}

Expand Down

0 comments on commit de9fc58

Please sign in to comment.