AGOS: attempt to fix bug no. 12617 ("AGOS: Deadlock when shutting down game")

I have also made the necessary changes to the PC-98 audio drivers which were written to work around the current situation, but now also need a different order in the destructors.
This commit is contained in:
athrxx 2021-06-11 17:42:26 +02:00
parent dda5f4e98b
commit 4a6dbc73db
2 changed files with 12 additions and 10 deletions

View File

@ -315,10 +315,10 @@ int PC98FMDriver::open() {
}
void PC98FMDriver::close() {
setTimerCallback(0, 0);
_isOpen = false;
delete _pc98a;
_pc98a = 0;
setTimerCallback(0, 0);
}
void PC98FMDriver::noteOn(uint8 part, uint8 note, uint8 velo) {
@ -610,16 +610,17 @@ int PC98MidiDriver::open() {
}
void PC98MidiDriver::close() {
setTimerCallback(0, 0);
_isOpen = false;
if (!_drv)
return;
_drv->setTimerCallback(0, 0);
_mixer->stopAll();
_drv->close();
delete _drv;
_drv = 0;
if (_drv) {
_drv->setTimerCallback(0, 0);
_mixer->stopAll();
_drv->close();
delete _drv;
_drv = 0;
}
setTimerCallback(0, 0);
}
void PC98MidiDriver::timerCallback(void *obj) {

View File

@ -77,13 +77,14 @@ MidiPlayer::MidiPlayer() {
MidiPlayer::~MidiPlayer() {
stop();
Common::StackLock lock(_mutex);
if (_driver) {
_driver->setTimerCallback(0, 0);
_driver->close();
delete _driver;
}
_driver = NULL;
Common::StackLock lock(_mutex);
clearConstructs();
}