1
0
mirror of https://github.com/cookiengineer/audacity synced 2026-01-09 22:27:07 +01:00

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.
This commit is contained in:
Paul Licameli
2018-10-06 11:20:30 -04:00
parent e6e4f44c81
commit 3f928a25b0
2 changed files with 5 additions and 3 deletions

View File

@@ -668,7 +668,8 @@ void MixerTrackCluster::UpdateMeter(const double t0, const double t1)
else if (meterFloatsArray[index] > 1.0) else if (meterFloatsArray[index] > 1.0)
meterFloatsArray[index] = 1.0; meterFloatsArray[index] = 1.0;
mMeter->UpdateDisplay(2, nFrames, meterFloatsArray.get()); if (mMeter)
mMeter->UpdateDisplay(2, nFrames, meterFloatsArray.get());
} }
else else
this->ResetMeter(false); this->ResetMeter(false);
@@ -704,7 +705,8 @@ void MixerTrackCluster::OnPaint(wxPaintEvent & WXUNUSED(event))
wxColour col = theTheme.Colour(selected ? clrTrackInfoSelected : clrTrackInfo) ; wxColour col = theTheme.Colour(selected ? clrTrackInfoSelected : clrTrackInfo) ;
SetBackgroundColour( col ); SetBackgroundColour( col );
mMeter->SetBackgroundColour( col ); if (mMeter)
mMeter->SetBackgroundColour( col );
mStaticText_TrackName->SetBackgroundColour( col ); mStaticText_TrackName->SetBackgroundColour( col );
mSlider_Gain->SetBackgroundColour( col ); mSlider_Gain->SetBackgroundColour( col );
mSlider_Pan->SetBackgroundColour( col ); mSlider_Pan->SetBackgroundColour( col );

View File

@@ -146,7 +146,7 @@ private:
#ifdef EXPERIMENTAL_MIDI_OUT #ifdef EXPERIMENTAL_MIDI_OUT
MixerTrackSlider* mSlider_Velocity; MixerTrackSlider* mSlider_Velocity;
#endif #endif
MeterPanel* mMeter; wxWeakRef<MeterPanel> mMeter;
public: public:
DECLARE_EVENT_TABLE() DECLARE_EVENT_TABLE()