diff --git a/src/FreqWindow.cpp b/src/FreqWindow.cpp index fb630a6f0..e6b8b6c40 100644 --- a/src/FreqWindow.cpp +++ b/src/FreqWindow.cpp @@ -532,17 +532,20 @@ bool FreqWindow::Show(bool show) bool shown = IsShown(); - bool res = wxDialog::Show(show); - if (show && !shown) { gPrefs->Read(ENV_DB_KEY, &dBRange, ENV_DB_RANGE); if(dBRange < 90.) dBRange = 90.; GetAudio(); - SendRecalcEvent(); + // Don't send an event. We need the recalc right away. + // so that mAnalyst is valid when we paint. + //SendRecalcEvent(); + Recalc(); } + bool res = wxDialog::Show(show); + return res; } @@ -859,7 +862,8 @@ void FreqWindow::PlotPaint(wxPaintEvent & event) wxPaintDC dc( (wxWindow *) event.GetEventObject() ); dc.DrawBitmap( *mBitmap, 0, 0, true ); - if (!mData) + // Fix for Bug 1226 "Plot Spectrum freezes... if insufficient samples selected" + if (!mData || mDataLen < mWindowSize) return; dc.SetFont(mFreqFont);