diff options
author | athrxx | 2019-08-07 21:46:36 +0200 |
---|---|---|
committer | athrxx | 2019-08-07 22:36:12 +0200 |
commit | ed297b4e4d4e54e3e3299c192240b7689e73ce2e (patch) | |
tree | 8761ad2ab12f47ade8e818b2ebd4e54b03586cc2 /engines/sci/sound/drivers/fb01.cpp | |
parent | 53501a475682ea9cf6f9c51690a8bfdbbbb4f26a (diff) | |
download | scummvm-rg350-ed297b4e4d4e54e3e3299c192240b7689e73ce2e.tar.gz scummvm-rg350-ed297b4e4d4e54e3e3299c192240b7689e73ce2e.tar.bz2 scummvm-rg350-ed297b4e4d4e54e3e3299c192240b7689e73ce2e.zip |
SCI: (FB01 sound driver) - fix potential lockup
(add another mutex lock)
Diffstat (limited to 'engines/sci/sound/drivers/fb01.cpp')
-rw-r--r-- | engines/sci/sound/drivers/fb01.cpp | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/engines/sci/sound/drivers/fb01.cpp b/engines/sci/sound/drivers/fb01.cpp index b083461d51..7f163a596e 100644 --- a/engines/sci/sound/drivers/fb01.cpp +++ b/engines/sci/sound/drivers/fb01.cpp @@ -159,6 +159,8 @@ MidiPlayer_Fb01::MidiPlayer_Fb01(SciVersion version) : MidiPlayer(version), _pla } MidiPlayer_Fb01::~MidiPlayer_Fb01() { + if (_driver) + _driver->setTimerCallback(NULL, NULL); Common::StackLock lock(_mutex); close(); delete _driver; @@ -526,6 +528,7 @@ void MidiPlayer_Fb01::midiTimerCallback(void *p) { } void MidiPlayer_Fb01::setTimerCallback(void *timer_param, Common::TimerManager::TimerProc timer_proc) { + Common::StackLock lock(_mutex); _driver->setTimerCallback(NULL, NULL); _timerParam = timer_param; @@ -635,9 +638,12 @@ int MidiPlayer_Fb01::open(ResourceManager *resMan) { } void MidiPlayer_Fb01::close() { + if (_driver) + _driver->setTimerCallback(NULL, NULL); Common::StackLock lock(_mutex); _isOpen = false; - _driver->close(); + if (_driver) + _driver->close(); } void MidiPlayer_Fb01::initTrack(SciSpan<const byte>& header) { |