[Scummvm-git-logs] scummvm master -> 0df79c20f4d7235c318f764d1e992ef67496867f

sluicebox noreply at scummvm.org
Wed Nov 5 23:08:30 UTC 2025


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:
0df79c20f4 PRIVATE: Stop video when loading game


Commit: 0df79c20f4d7235c318f764d1e992ef67496867f
    https://github.com/scummvm/scummvm/commit/0df79c20f4d7235c318f764d1e992ef67496867f
Author: sluicebox (22204938+sluicebox at users.noreply.github.com)
Date: 2025-11-05T15:07:55-08:00

Commit Message:
PRIVATE: Stop video when loading game

Loading a game while a video was paused caused the video to keep playing
from the previous game.

Also removes redundant SmackerDecoder::close() calls before delete,
as the SmackerDecoder destructor calls close().

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


diff --git a/engines/private/private.cpp b/engines/private/private.cpp
index a13b7cf7c6b..1f850c2a852 100644
--- a/engines/private/private.cpp
+++ b/engines/private/private.cpp
@@ -124,10 +124,7 @@ PrivateEngine::PrivateEngine(OSystem *syst, const ADGameDescription *gd)
 }
 
 PrivateEngine::~PrivateEngine() {
-	if (_videoDecoder != _pausedVideo) {
-		delete _pausedVideo;
-	}
-	delete _videoDecoder;
+	destroyVideo();
 
 	delete _compositeSurface;
 	if (_frameImage != nullptr) {
@@ -434,7 +431,6 @@ Common::Error PrivateEngine::run() {
 			}
 
 			if (_videoDecoder->endOfVideo()) {
-				_videoDecoder->close();
 				delete _videoDecoder;
 				_videoDecoder = nullptr;
 				if (_subtitles != nullptr) {
@@ -1235,12 +1231,7 @@ void PrivateEngine::restartGame() {
 	// Movies
 	_repeatedMovieExit = "";
 	_playedMovies.clear();
-	if (_videoDecoder != _pausedVideo) {
-		delete _pausedVideo;
-	}
-	delete _videoDecoder;
-	_videoDecoder = nullptr;
-	_pausedVideo = nullptr;
+	destroyVideo();
 
 	// Pause
 	_pausedSetting = "";
@@ -1250,9 +1241,9 @@ void PrivateEngine::restartGame() {
 }
 
 Common::Error PrivateEngine::loadGameStream(Common::SeekableReadStream *stream) {
-	// We don't want to continue with any sound from a previous game
+	// We don't want to continue with any sound or videos from a previous game
 	stopSound(true);
-	_pausedVideo = nullptr;
+	destroyVideo();
 
 	Common::Serializer s(stream, nullptr);
 	debugC(1, kPrivateDebugFunction, "loadGameStream");
@@ -1593,7 +1584,6 @@ void PrivateEngine::playVideo(const Common::String &name) {
 }
 
 void PrivateEngine::skipVideo() {
-	_videoDecoder->close();
 	delete _videoDecoder;
 	_videoDecoder = nullptr;
 	if (_subtitles != nullptr) {
@@ -1604,6 +1594,15 @@ void PrivateEngine::skipVideo() {
 	_currentMovie = "";
 }
 
+void PrivateEngine::destroyVideo() {
+	if (_videoDecoder != _pausedVideo) {
+		delete _pausedVideo;
+	}
+	delete _videoDecoder;
+	_videoDecoder = nullptr;
+	_pausedVideo = nullptr;
+}
+
 void PrivateEngine::stopSound(bool all) {
 	debugC(1, kPrivateDebugFunction, "%s(%d)", __FUNCTION__, all);
 
diff --git a/engines/private/private.h b/engines/private/private.h
index eef3b4f5b5b..4962c1c1d96 100644
--- a/engines/private/private.h
+++ b/engines/private/private.h
@@ -221,6 +221,7 @@ public:
 	Common::Path convertPath(const Common::String &);
 	void playVideo(const Common::String &);
 	void skipVideo();
+	void destroyVideo();
 
 	void loadSubtitles(const Common::Path &path);
 	void adjustSubtitleSize();




More information about the Scummvm-git-logs mailing list