[Scummvm-git-logs] scummvm master -> 0210872b8d8094ade204ec3e4421e6c681bd4dcf

neuromancer noreply at scummvm.org
Wed Nov 12 06:19:11 UTC 2025


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

Summary:
defd67cc0d PRIVATE: Fix memory leak when loading Mac installer
0210872b8d PRIVATE: Load Mac cursors from installer


Commit: defd67cc0d3ac7971cc0f18df58722b3c929a695
    https://github.com/scummvm/scummvm/commit/defd67cc0d3ac7971cc0f18df58722b3c929a695
Author: sluicebox (22204938+sluicebox at users.noreply.github.com)
Date: 2025-11-12T07:19:05+01:00

Commit Message:
PRIVATE: Fix memory leak when loading Mac installer

Changed paths:
    engines/private/private.cpp
    engines/private/private.h


diff --git a/engines/private/private.cpp b/engines/private/private.cpp
index 9ff22b7fb93..a52fdffc9aa 100644
--- a/engines/private/private.cpp
+++ b/engines/private/private.cpp
@@ -173,7 +173,6 @@ void PrivateEngine::initializePath(const Common::FSNode &gamePath) {
 Common::SeekableReadStream *PrivateEngine::loadAssets() {
 
 	Common::File *test = new Common::File();
-	Common::SeekableReadStream *file = nullptr;
 
 	if (isDemo() && test->open("SUPPORT/ASSETS/DEMOGAME.WIN"))
 		return test;
@@ -187,19 +186,15 @@ Common::SeekableReadStream *PrivateEngine::loadAssets() {
 
 	delete test;
 
-	if (_platform == Common::kPlatformMacintosh && _language == Common::JA_JPN)
-		file = Common::MacResManager::openFileOrDataFork("xn--16jc8na7ay6a0eyg9e5nud0e4525d");
-	else
-		file = Common::MacResManager::openFileOrDataFork(isDemo() ? "Private Eye Demo Installer" : "Private Eye Installer");
-	if (file) {
-		Common::Archive *s = createStuffItArchive(file, true);
-		Common::SeekableReadStream *file2 = nullptr;
-		if (s)
-			file2 = s->createReadStreamForMember(isDemo() ? "demogame.mac" : "game.mac");
-		// file2 is enough to keep valid reference
-		delete file;
-		if (file2)
-			return file2;
+	if (_platform == Common::kPlatformMacintosh) {
+		Common::ScopedPtr<Common::Archive> macInstaller(loadMacInstaller());
+		if (macInstaller) {
+			const char *macFileName = isDemo() ? "demogame.mac" : "game.mac";
+			Common::SeekableReadStream *file = macInstaller->createReadStreamForMember(macFileName);
+			if (file != nullptr) {
+				return file;
+			}
+		}
 	}
 
 	Common::InstallShieldV3 installerArchive;
@@ -229,6 +224,25 @@ Common::SeekableReadStream *PrivateEngine::loadAssets() {
 	return nullptr;
 }
 
+Common::Archive *PrivateEngine::loadMacInstaller() {
+	const char *fileName;
+	if (_language == Common::JA_JPN) {
+		fileName = "xn--16jc8na7ay6a0eyg9e5nud0e4525d";
+	} else if (isDemo()) {
+		fileName = "Private Eye Demo Installer";
+	} else {
+		fileName = "Private Eye Installer";
+	}
+
+	Common::SeekableReadStream *archiveFile = Common::MacResManager::openFileOrDataFork(fileName);
+	if (archiveFile == nullptr) {
+		return nullptr;
+	}
+
+	// createStuffItArchive() takes ownership of incoming stream, even on failure
+	return createStuffItArchive(archiveFile, true);
+}
+
 Common::Error PrivateEngine::run() {
 
 	// Only enable if subtitles are available
diff --git a/engines/private/private.h b/engines/private/private.h
index 2efef82bf48..680a249c7a5 100644
--- a/engines/private/private.h
+++ b/engines/private/private.h
@@ -32,6 +32,10 @@
 
 #include "private/grammar.h"
 
+namespace Common {
+class Archive;
+}
+
 namespace Image {
 class ImageDecoder;
 }
@@ -196,6 +200,7 @@ public:
 	void clearAreas();
 	void initializePath(const Common::FSNode &gamePath) override;
 	Common::SeekableReadStream *loadAssets();
+	Common::Archive *loadMacInstaller();
 
 	// Functions
 


Commit: 0210872b8d8094ade204ec3e4421e6c681bd4dcf
    https://github.com/scummvm/scummvm/commit/0210872b8d8094ade204ec3e4421e6c681bd4dcf
Author: sluicebox (22204938+sluicebox at users.noreply.github.com)
Date: 2025-11-12T07:19:05+01:00

Commit Message:
PRIVATE: Load Mac cursors from installer

Changed paths:
    engines/private/cursors.cpp


diff --git a/engines/private/cursors.cpp b/engines/private/cursors.cpp
index c2b3d18828f..a74c9d47ea1 100644
--- a/engines/private/cursors.cpp
+++ b/engines/private/cursors.cpp
@@ -123,8 +123,10 @@ void PrivateEngine::loadCursors() {
 
 		Common::MacResManager resMan;
 
-		Common::String path = isDemo() ? "SUPPORT/Private Eye Demo" : "SUPPORT/Private Eye";
-		if (resMan.open(path.c_str())) {
+		const char *executableFilePath = isDemo() ? "SUPPORT/Private Eye Demo" : "SUPPORT/Private Eye";
+		const char *executableInstallerPath = isDemo() ? "Private Eye Demo" : "Private Eye";
+		Common::ScopedPtr<Common::Archive> macInstaller(loadMacInstaller());
+		if (resMan.open(executableFilePath) || (macInstaller && resMan.open(executableInstallerPath, *macInstaller))) {
 			const Common::MacResIDArray cursorResIDs = resMan.getResIDArray(MKTAG('C', 'U', 'R', 'S'));
 			_cursors.resize(cursorResIDs.size());
 




More information about the Scummvm-git-logs mailing list