MidiPlayer: Fix crash when dropping a midi file

Window must be locked or MidiRunThread crashes with a segment violation.

Change-Id: I9d5d0fa477475a9b5ba877aea3d6583690aacb2b
Reviewed-on: https://review.haiku-os.org/c/1080
Reviewed-by: Barrett17 <[email protected]>
This commit is contained in:
John Scipione
2019-02-25 11:57:46 +00:00
committed by Barrett17
parent 5b88998b2d
commit 65c0d507d3
+8 -7
View File
@@ -427,17 +427,18 @@ MidiPlayerWindow::_StopHook(int32 arg)
void
MidiPlayerWindow::StopHook()
{
Lock();
if (Lock()) {
// we may be called from the synth's thread
fIsPlaying = false;
fIsPlaying = false;
fScopeView->SetPlaying(false);
fScopeView->Invalidate();
fPlayButton->SetEnabled(true);
fPlayButton->SetLabel(B_TRANSLATE("Play"));
fScopeView->SetPlaying(false);
fScopeView->Invalidate();
fPlayButton->SetEnabled(true);
fPlayButton->SetLabel(B_TRANSLATE("Play"));
Unlock();
Unlock();
}
}