[Scummvm-git-logs] scummvm master -> 163f59d870f4bf635ec29254541c4a72ca63971a

whoozle noreply at scummvm.org
Sat Mar 7 01:30:42 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:
163f59d870 VIDEO: FOURXM: take ownership of stream


Commit: 163f59d870f4bf635ec29254541c4a72ca63971a
    https://github.com/scummvm/scummvm/commit/163f59d870f4bf635ec29254541c4a72ca63971a
Author: Vladimir Menshakov (vladimir.menshakov at gmail.com)
Date: 2026-03-07T01:28:57Z

Commit Message:
VIDEO: FOURXM: take ownership of stream

Proper fix of the leak in PHOENIXVR playMovie/minor field cleanups

Changed paths:
    engines/phoenixvr/phoenixvr.cpp
    video/4xm_decoder.cpp
    video/4xm_decoder.h


diff --git a/engines/phoenixvr/phoenixvr.cpp b/engines/phoenixvr/phoenixvr.cpp
index c6a78720af6..91b137ad618 100644
--- a/engines/phoenixvr/phoenixvr.cpp
+++ b/engines/phoenixvr/phoenixvr.cpp
@@ -337,7 +337,7 @@ void PhoenixVREngine::playMovie(const Common::String &movie) {
 		warning("can't load movie %s", movie.c_str());
 		return;
 	}
-	if (dec.loadStream(stream.get())) {
+	if (dec.loadStream(stream.release())) {
 		dec.start();
 
 		bool playing = true;
diff --git a/video/4xm_decoder.cpp b/video/4xm_decoder.cpp
index ec9c1a88a96..98c9a85221c 100644
--- a/video/4xm_decoder.cpp
+++ b/video/4xm_decoder.cpp
@@ -58,11 +58,10 @@ static const int8_t mv[256][2] = {
 class FourXMDecoder::FourXMAudioTrack : public AudioTrack {
 	uint _audioType;
 	uint _audioChannels;
-	//uint _sampleRate;
 	Common::ScopedPtr<Audio::PacketizedAudioStream> _output;
 
 public:
-	FourXMAudioTrack(FourXMDecoder *dec, uint trackIdx, uint audioType, uint audioChannels, uint sampleRate) : AudioTrack(Audio::Mixer::SoundType::kPlainSoundType), _audioType(audioType), _audioChannels(audioChannels)/*, _sampleRate(sampleRate)*/ {
+	FourXMAudioTrack(FourXMDecoder *dec, uint trackIdx, uint audioType, uint audioChannels, uint sampleRate) : AudioTrack(Audio::Mixer::SoundType::kPlainSoundType), _audioType(audioType), _audioChannels(audioChannels) {
 		switch (_audioType) {
 		case 0: {
 			// Raw PCM data
@@ -646,6 +645,7 @@ void FourXMDecoder::readList(uint32 listEnd) {
 }
 
 bool FourXMDecoder::loadStream(Common::SeekableReadStream *stream) {
+	_stream.reset(stream);
 	if (!stream->size()) {
 		return false;
 	}
@@ -664,8 +664,6 @@ bool FourXMDecoder::loadStream(Common::SeekableReadStream *stream) {
 		return false;
 	}
 
-	_stream = stream;
-
 	while (stream->pos() < fileSize) {
 		uint32 tag = stream->readUint32BE();
 		uint32 size = stream->readUint32LE();
diff --git a/video/4xm_decoder.h b/video/4xm_decoder.h
index 4303de02220..ebe6b6077fe 100644
--- a/video/4xm_decoder.h
+++ b/video/4xm_decoder.h
@@ -19,6 +19,7 @@
  *
  */
 
+#include "common/ptr.h"
 #include "video/video_decoder.h"
 
 namespace Video {
@@ -50,7 +51,7 @@ private:
 
 	uint32 _dataRate = 0;
 	Common::Rational _frameRate;
-	Common::SeekableReadStream *_stream;
+	Common::ScopedPtr<Common::SeekableReadStream> _stream;
 	Common::Array<Frame> _frames;
 	uint _curFrame = 0;
 	FourXMVideoTrack *_video = nullptr;




More information about the Scummvm-git-logs mailing list