aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--engines/sci/sound/drivers/fb01.cpp8
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) {