[Scummvm-git-logs] scummvm master -> 4a6dbc73dbb19b82f1e8ebfe5f1bd9248db2a647

athrxx athrxx at scummvm.org
Fri Jun 11 15:54:14 UTC 2021


This automated email contains information about 1 new commit which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .

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


Commit: 4a6dbc73dbb19b82f1e8ebfe5f1bd9248db2a647
    https://github.com/scummvm/scummvm/commit/4a6dbc73dbb19b82f1e8ebfe5f1bd9248db2a647
Author: athrxx (athrxx at scummvm.org)
Date: 2021-06-11T17:49:33+02:00

Commit Message:
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.

Changed paths:
    engines/agos/drivers/accolade/pc98.cpp
    engines/agos/midi.cpp


diff --git a/engines/agos/drivers/accolade/pc98.cpp b/engines/agos/drivers/accolade/pc98.cpp
index 21718c1651..a586ccc74f 100644
--- a/engines/agos/drivers/accolade/pc98.cpp
+++ b/engines/agos/drivers/accolade/pc98.cpp
@@ -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) {
diff --git a/engines/agos/midi.cpp b/engines/agos/midi.cpp
index 8ea69c462b..8aca0bbf8c 100644
--- a/engines/agos/midi.cpp
+++ b/engines/agos/midi.cpp
@@ -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();
 }
 




More information about the Scummvm-git-logs mailing list