Skip to content
Permalink
Browse files
Bug2004: Opening Mixer Board with a Note track crashed...
... Just one null check was needed, but I also add another, and use a
wxWeakRef pointer, for more safety.
  • Loading branch information
Paul-Licameli committed Oct 6, 2018
1 parent e6e4f44 commit 3f928a25b009b11111579d807d79f6f1633807f6
Showing with 5 additions and 3 deletions.
  1. +4 −2 src/MixerBoard.cpp
  2. +1 −1 src/MixerBoard.h
@@ -668,7 +668,8 @@ void MixerTrackCluster::UpdateMeter(const double t0, const double t1)
else if (meterFloatsArray[index] > 1.0)
meterFloatsArray[index] = 1.0;

mMeter->UpdateDisplay(2, nFrames, meterFloatsArray.get());
if (mMeter)
mMeter->UpdateDisplay(2, nFrames, meterFloatsArray.get());
}
else
this->ResetMeter(false);
@@ -704,7 +705,8 @@ void MixerTrackCluster::OnPaint(wxPaintEvent & WXUNUSED(event))

wxColour col = theTheme.Colour(selected ? clrTrackInfoSelected : clrTrackInfo) ;
SetBackgroundColour( col );
mMeter->SetBackgroundColour( col );
if (mMeter)
mMeter->SetBackgroundColour( col );
mStaticText_TrackName->SetBackgroundColour( col );
mSlider_Gain->SetBackgroundColour( col );
mSlider_Pan->SetBackgroundColour( col );
@@ -146,7 +146,7 @@ class MixerTrackCluster final : public wxPanelWrapper
#ifdef EXPERIMENTAL_MIDI_OUT
MixerTrackSlider* mSlider_Velocity;
#endif
MeterPanel* mMeter;
wxWeakRef<MeterPanel> mMeter;

public:
DECLARE_EVENT_TABLE()

0 comments on commit 3f928a2

Please sign in to comment.