Don't cause assertion violations when showing Lyrics window

This commit is contained in:
Paul Licameli 2016-06-27 21:25:03 -04:00
parent 0b58cc7483
commit 079c268b34
2 changed files with 9 additions and 4 deletions

View File

@ -464,14 +464,18 @@ void Lyrics::OnKeyEvent(wxKeyEvent & event)
}
void Lyrics::OnPaint(wxPaintEvent & WXUNUSED(event))
{
wxPaintDC dc(this);
DoPaint(dc);
}
void Lyrics::DoPaint(wxDC &dc)
{
if (!this->GetParent()->IsShown())
return;
if (mLyricsStyle == kBouncingBallLyrics)
{
wxPaintDC dc(this);
if (!mMeasurementsDone)
Measure(&dc);
@ -509,8 +513,8 @@ void Lyrics::OnSize(wxSizeEvent & WXUNUSED(event))
if (mLyricsStyle == kBouncingBallLyrics)
{
mMeasurementsDone = false;
wxPaintEvent ignore;
this->OnPaint(ignore);
wxClientDC dc(this);
this->DoPaint(dc);
}
else // (mLyricsStyle == kHighlightLyrics)
{

View File

@ -92,6 +92,7 @@ class Lyrics final : public wxPanelWrapper
// Event handlers
//
void OnKeyEvent(wxKeyEvent & event);
void DoPaint(wxDC &dc);
void OnPaint(wxPaintEvent &evt);
void OnSize(wxSizeEvent &evt);