[Scummvm-git-logs] scummvm master -> 8323532d4f5279a5d7216ccbbe86a4772fe5f91e

dreammaster noreply at scummvm.org
Mon Jul 27 04:21:18 UTC 2026


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

Summary:
8323532d4f MADS: NEBULAR: Fix Adlib ASound driver crash


Commit: 8323532d4f5279a5d7216ccbbe86a4772fe5f91e
    https://github.com/scummvm/scummvm/commit/8323532d4f5279a5d7216ccbbe86a4772fe5f91e
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2026-07-27T14:21:10+10:00

Commit Message:
MADS: NEBULAR: Fix Adlib ASound driver crash

Changed paths:
    engines/mads/nebular/asound.cpp
    engines/mads/nebular/asound.h


diff --git a/engines/mads/nebular/asound.cpp b/engines/mads/nebular/asound.cpp
index 22c5124cc76..76f6ad466ad 100644
--- a/engines/mads/nebular/asound.cpp
+++ b/engines/mads/nebular/asound.cpp
@@ -157,13 +157,21 @@ ASound::ASound(Audio::Mixer *mixer, const Common::Path &filename, int dataOffset
 
 	AdlibChannel::_channelsEnabled = false;
 
+	// Initialize the OPL instance
+	_opl = OPL::Config::create();
+	_opl->init();
+	_opl->start(new Common::Functor0Mem<void, ASound>(this, &ASound::onTimer), CALLBACKS_PER_SECOND);
+
 	// Initialize the Adlib
 	adlibInit();
 
 	// Reset the adlib
 	command0();
+}
 
-	_opl->start(new Common::Functor0Mem<void, ASound>(this, &ASound::onTimer), CALLBACKS_PER_SECOND);
+ASound::~ASound() {
+	_opl->stop();
+	delete _opl;
 }
 
 void ASound::validate() {
diff --git a/engines/mads/nebular/asound.h b/engines/mads/nebular/asound.h
index 687ac82aede..8ab06465d11 100644
--- a/engines/mads/nebular/asound.h
+++ b/engines/mads/nebular/asound.h
@@ -134,7 +134,7 @@ struct RegisterValue {
  */
 class ASound : public SoundDriver {
 private:
-	OPL::OPL *_opl = OPL::Config::create();
+	OPL::OPL *_opl;
 	uint16 _randomSeed;
 	int _masterVolume;
 
@@ -349,9 +349,7 @@ public:
 	/**
 	 * Destructor
 	 */
-	~ASound() override {
-		delete _opl;
-	}
+	~ASound() override;
 
 	/**
 	 * Stop all currently playing sounds




More information about the Scummvm-git-logs mailing list