Fix crash when playback cursor leaves the visible part of the audio display on wxMac.

Originally committed to SVN as r1572.
This commit is contained in:
Niels Martin Hansen 2007-09-21 21:24:32 +00:00
parent 6b4ec2dcc5
commit 6587f4882a

View file

@ -1956,6 +1956,7 @@ void AudioDisplay::OnUpdateTimer(wxTimerEvent &event) {
// Draw cursor // Draw cursor
wxMemoryDC src; wxMemoryDC src;
curpos = GetXAtSample(curPos); curpos = GetXAtSample(curPos);
if (curpos >= 0 && curpos < GetClientSize().GetWidth()) {
dc.SetPen(wxPen(Options.AsColour(_T("Audio Play cursor")))); dc.SetPen(wxPen(Options.AsColour(_T("Audio Play cursor"))));
src.SelectObject(*origImage); src.SelectObject(*origImage);
if (fullDraw) { if (fullDraw) {
@ -1969,6 +1970,7 @@ void AudioDisplay::OnUpdateTimer(wxTimerEvent &event) {
dc.DrawLine(curpos,0,curpos,h); dc.DrawLine(curpos,0,curpos,h);
} }
} }
}
else { else {
if (curPos > player->GetEndPosition() + 8192) { if (curPos > player->GetEndPosition() + 8192) {
player->Stop(); player->Stop();