Fix segfault when moving channels
This commit addresses a lot of issues, namely: 1. When the "Move left/right" action was selected on a mixer channel menu sometimes it would segfault due to the fxline object being deleted before it returned to a method inside itself 2. The Fader was declaring a new variable for the model whereas it should used the inherited model from FloatModelView < AutomatableModelView 3. Some methods were doing more things than they should be and performing unnecessary actions. A little cleanup/refactor was made Please notice that a bug of the same class as the one referred at point 1 still exists: clicking on "Remove channel". This commit does not addresses this issue. Fixes #1584
This commit is contained in:
@@ -100,14 +100,12 @@ private:
|
||||
|
||||
int knobPosY() const
|
||||
{
|
||||
float fRange = m_model->maxValue() - m_model->minValue();
|
||||
float realVal = m_model->value() - m_model->minValue();
|
||||
float fRange = model()->maxValue() - model()->minValue();
|
||||
float realVal = model()->value() - model()->minValue();
|
||||
|
||||
return height() - ( ( height() - m_knob->height() ) * ( realVal / fRange ) );
|
||||
}
|
||||
|
||||
FloatModel * m_model;
|
||||
|
||||
void setPeak( float fPeak, float &targetPeak, float &persistentPeak, QTime &lastPeakTime );
|
||||
int calculateDisplayPeak( float fPeak );
|
||||
|
||||
|
||||
@@ -53,6 +53,8 @@ public:
|
||||
public:
|
||||
FxChannelView(QWidget * _parent, FxMixerView * _mv, int _chIndex );
|
||||
|
||||
void setChannelIndex( int index );
|
||||
|
||||
FxLine * m_fxLine;
|
||||
PixmapButton * m_muteBtn;
|
||||
PixmapButton * m_soloBtn;
|
||||
@@ -97,6 +99,7 @@ public:
|
||||
|
||||
// move the channel to the left or right
|
||||
void moveChannelLeft(int index);
|
||||
void moveChannelLeft(int index, int focusIndex);
|
||||
void moveChannelRight(int index);
|
||||
|
||||
// make sure the display syncs up with the fx mixer.
|
||||
|
||||
Reference in New Issue
Block a user