[Scummvm-git-logs] scummvm master -> 61e25cf7800c206538d860e10b7b4124ffa9fb7f

sluicebox noreply at scummvm.org
Tue Oct 1 15:32:43 UTC 2024


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

Summary:
e88d3ef156 ILLUSIONS: Fix memory leaks in BBDOU inventory
772476bc37 ILLUSIONS: Fix memory leaks in BBDOU special code
dce5ed562c ILLUSIONS: Fix memory leak in ScreenText
d03e6cb0f7 ILLUSIONS: Fix memory leak in ScriptResource
1ebd95f0bc ILLUSIONS: Fix BBDOU screen palette memory leak
4e3ef0a15e ILLUSIONS: Fix memory leak in BackgroundInstance
e23ce9acc9 ILLUSIONS: Fix memory leaks in FontResource
61e25cf780 ILLUSIONS: Fix resource memory leaks on exit


Commit: e88d3ef15696c066369552462a39ac4a75abd886
    https://github.com/scummvm/scummvm/commit/e88d3ef15696c066369552462a39ac4a75abd886
Author: sluicebox (22204938+sluicebox at users.noreply.github.com)
Date: 2024-10-01T09:29:59-06:00

Commit Message:
ILLUSIONS: Fix memory leaks in BBDOU inventory

Changed paths:
    engines/illusions/bbdou/bbdou_inventory.cpp
    engines/illusions/bbdou/bbdou_inventory.h


diff --git a/engines/illusions/bbdou/bbdou_inventory.cpp b/engines/illusions/bbdou/bbdou_inventory.cpp
index 33e9007a127..55bc6b3b51d 100644
--- a/engines/illusions/bbdou/bbdou_inventory.cpp
+++ b/engines/illusions/bbdou/bbdou_inventory.cpp
@@ -51,6 +51,12 @@ InventoryBag::InventoryBag(IllusionsEngine_BBDOU *vm, uint32 sceneId)
 	: _vm(vm), _sceneId(sceneId), _isActive(false), _fieldA(0) {
 }
 
+InventoryBag::~InventoryBag() {
+	for (uint i = 0; i < _inventorySlots.size(); ++i) {
+		delete _inventorySlots[i];
+	}
+}
+
 void InventoryBag::registerInventorySlot(uint32 namedPointId) {
 	_inventorySlots.push_back(new InventorySlot(namedPointId));
 }
@@ -140,6 +146,15 @@ BbdouInventory::BbdouInventory(IllusionsEngine_BBDOU *vm, BbdouSpecialCode *bbdo
 	: _vm(vm), _bbdou(bbdou), _activeInventorySceneId(0) {
 }
 
+BbdouInventory::~BbdouInventory() {
+	for (uint i = 0; i < _inventoryBags.size(); ++i) {
+		delete _inventoryBags[i];
+	}
+	for (uint i = 0; i < _inventoryItems.size(); ++i) {
+		delete _inventoryItems[i];
+	}
+}
+
 void BbdouInventory::registerInventoryBag(uint32 sceneId) {
 	_inventoryBags.push_back(new InventoryBag(_vm, sceneId));
 	_activeBagSceneId = sceneId;
diff --git a/engines/illusions/bbdou/bbdou_inventory.h b/engines/illusions/bbdou/bbdou_inventory.h
index 17673fb80ce..d54b02381a6 100644
--- a/engines/illusions/bbdou/bbdou_inventory.h
+++ b/engines/illusions/bbdou/bbdou_inventory.h
@@ -53,6 +53,7 @@ struct InventorySlot {
 class InventoryBag {
 public:
 	InventoryBag(IllusionsEngine_BBDOU *vm, uint32 sceneId);
+	~InventoryBag();
 	void registerInventorySlot(uint32 namedPointId);
 	bool addInventoryItem(InventoryItem *inventoryItem, InventorySlot *inventorySlot);
 	void removeInventoryItem(InventoryItem *inventoryItem);
@@ -75,6 +76,7 @@ public:
 class BbdouInventory {
 public:
 	BbdouInventory(IllusionsEngine_BBDOU *vm, BbdouSpecialCode *bbdou);
+	~BbdouInventory();
 	void registerInventoryBag(uint32 sceneId);
 	void registerInventoryItem(uint32 objectId, uint32 sequenceId);
 	void registerInventorySlot(uint32 namedPointId);


Commit: 772476bc37bdac854d965dd89b19e9f4e339bd28
    https://github.com/scummvm/scummvm/commit/772476bc37bdac854d965dd89b19e9f4e339bd28
Author: sluicebox (22204938+sluicebox at users.noreply.github.com)
Date: 2024-10-01T09:30:00-06:00

Commit Message:
ILLUSIONS: Fix memory leaks in BBDOU special code

Changed paths:
    engines/illusions/bbdou/bbdou_specialcode.cpp
    engines/illusions/bbdou/illusions_bbdou.cpp
    engines/illusions/duckman/illusions_duckman.cpp
    engines/illusions/illusions.cpp


diff --git a/engines/illusions/bbdou/bbdou_specialcode.cpp b/engines/illusions/bbdou/bbdou_specialcode.cpp
index 9f68b75c8b3..860ebd34c65 100644
--- a/engines/illusions/bbdou/bbdou_specialcode.cpp
+++ b/engines/illusions/bbdou/bbdou_specialcode.cpp
@@ -161,6 +161,10 @@ BbdouSpecialCode::~BbdouSpecialCode() {
 	delete _inventory;
 	delete _cursor;
 	delete _bubble;
+
+	for (MapIterator it = _map.begin(); it != _map.end(); ++it) {
+		delete (*it)._value;
+	}
 }
 
 typedef Common::Functor1Mem<OpCall&, void, BbdouSpecialCode> SpecialCodeFunctionI;
diff --git a/engines/illusions/bbdou/illusions_bbdou.cpp b/engines/illusions/bbdou/illusions_bbdou.cpp
index 63aba763267..ff74dc5870d 100644
--- a/engines/illusions/bbdou/illusions_bbdou.cpp
+++ b/engines/illusions/bbdou/illusions_bbdou.cpp
@@ -229,6 +229,8 @@ Common::Error IllusionsEngine_BBDOU::run() {
 		updateEvents();
 	}
 
+	unloadSpecialCode(0);
+
 	delete _stack;
 	delete _scriptOpcodes;
 
diff --git a/engines/illusions/duckman/illusions_duckman.cpp b/engines/illusions/duckman/illusions_duckman.cpp
index 4e5bf4560e1..61f9dcef3d2 100644
--- a/engines/illusions/duckman/illusions_duckman.cpp
+++ b/engines/illusions/duckman/illusions_duckman.cpp
@@ -446,6 +446,7 @@ void IllusionsEngine_Duckman::loadSpecialCode(uint32 resId) {
 
 void IllusionsEngine_Duckman::unloadSpecialCode(uint32 resId) {
 	delete _specialCode;
+	_specialCode = nullptr;
 }
 
 void IllusionsEngine_Duckman::notifyThreadId(uint32 &threadId) {
diff --git a/engines/illusions/illusions.cpp b/engines/illusions/illusions.cpp
index b85574e59f0..4174ccf005f 100644
--- a/engines/illusions/illusions.cpp
+++ b/engines/illusions/illusions.cpp
@@ -81,7 +81,7 @@ void swapBytesInWideString(byte *wstr) {
 }
 
 IllusionsEngine::IllusionsEngine(OSystem *syst, const IllusionsGameDescription *gd) :
-	Engine(syst), _gameDescription(gd) {
+	Engine(syst), _gameDescription(gd), _specialCode(nullptr) {
 
 	_random = new Common::RandomSource("illusions");
 


Commit: dce5ed562cce7bfbb6494cd92f29ca78563aad5f
    https://github.com/scummvm/scummvm/commit/dce5ed562cce7bfbb6494cd92f29ca78563aad5f
Author: sluicebox (22204938+sluicebox at users.noreply.github.com)
Date: 2024-10-01T09:30:00-06:00

Commit Message:
ILLUSIONS: Fix memory leak in ScreenText

Changed paths:
    engines/illusions/screentext.cpp


diff --git a/engines/illusions/screentext.cpp b/engines/illusions/screentext.cpp
index 62f26f8eabe..5947819ebe6 100644
--- a/engines/illusions/screentext.cpp
+++ b/engines/illusions/screentext.cpp
@@ -35,6 +35,10 @@ ScreenText::ScreenText(IllusionsEngine *vm)
 
 ScreenText::~ScreenText() {
 	freeTextSurface();
+
+	for (Common::List<ScreenTextEntry*>::iterator it = _screenTexts.begin(); it != _screenTexts.end(); ++it) {
+		delete (*it);
+	}
 }
 
 void ScreenText::getTextInfoDimensions(WidthHeight &textInfoDimensions) {


Commit: d03e6cb0f7d9c9988a42021c98df5db4c279e8c6
    https://github.com/scummvm/scummvm/commit/d03e6cb0f7d9c9988a42021c98df5db4c279e8c6
Author: sluicebox (22204938+sluicebox at users.noreply.github.com)
Date: 2024-10-01T09:30:01-06:00

Commit Message:
ILLUSIONS: Fix memory leak in ScriptResource

Changed paths:
    engines/illusions/resources/scriptresource.cpp


diff --git a/engines/illusions/resources/scriptresource.cpp b/engines/illusions/resources/scriptresource.cpp
index 3ff08e842ab..195549303b7 100644
--- a/engines/illusions/resources/scriptresource.cpp
+++ b/engines/illusions/resources/scriptresource.cpp
@@ -278,11 +278,12 @@ void SceneInfo::fixupSceneInfosDuckman() {
 // ScriptResource
 
 ScriptResource::ScriptResource()
-	: _codeOffsets(nullptr), _objectMap(nullptr) {
+	: _codeOffsets(nullptr), _sceneInfos(nullptr), _objectMap(nullptr)  {
 }
 
 ScriptResource::~ScriptResource() {
 	delete[] _codeOffsets;
+	delete[] _sceneInfos;
 	delete[] _objectMap;
 }
 


Commit: 1ebd95f0bc9712b3be6ef01af8bdd90f29cd955a
    https://github.com/scummvm/scummvm/commit/1ebd95f0bc9712b3be6ef01af8bdd90f29cd955a
Author: sluicebox (22204938+sluicebox at users.noreply.github.com)
Date: 2024-10-01T09:30:01-06:00

Commit Message:
ILLUSIONS: Fix BBDOU screen palette memory leak

Changed paths:
    engines/illusions/bbdou/illusions_bbdou.cpp


diff --git a/engines/illusions/bbdou/illusions_bbdou.cpp b/engines/illusions/bbdou/illusions_bbdou.cpp
index ff74dc5870d..9d78ffa35c3 100644
--- a/engines/illusions/bbdou/illusions_bbdou.cpp
+++ b/engines/illusions/bbdou/illusions_bbdou.cpp
@@ -250,6 +250,7 @@ Common::Error IllusionsEngine_BBDOU::run() {
 	delete _actorInstances;
 	delete _input;
 	delete _screenText;
+	delete _screenPalette;
 	delete _screen;
 	delete _resSys;
 	delete _resReader;


Commit: 4e3ef0a15e4333de5eb29f51a78f95f5b5297f8f
    https://github.com/scummvm/scummvm/commit/4e3ef0a15e4333de5eb29f51a78f95f5b5297f8f
Author: sluicebox (22204938+sluicebox at users.noreply.github.com)
Date: 2024-10-01T09:30:01-06:00

Commit Message:
ILLUSIONS: Fix memory leak in BackgroundInstance

Occurs in BBDOU when using the map to change rooms

Changed paths:
    engines/illusions/resources/backgroundresource.cpp
    engines/illusions/resources/backgroundresource.h


diff --git a/engines/illusions/resources/backgroundresource.cpp b/engines/illusions/resources/backgroundresource.cpp
index 4916c4609d1..37f29505d27 100644
--- a/engines/illusions/resources/backgroundresource.cpp
+++ b/engines/illusions/resources/backgroundresource.cpp
@@ -384,6 +384,10 @@ BackgroundInstance::BackgroundInstance(IllusionsEngine *vm)
 	: _vm(vm), _sceneId(0), _pauseCtr(0), _bgRes(nullptr), _savedPalette(nullptr) {
 }
 
+BackgroundInstance::~BackgroundInstance() {
+	delete[] _savedPalette;
+}
+
 void BackgroundInstance::load(Resource *resource) {
 	debug(1, "BackgroundResourceLoader::load() Loading background %08X from %s...", resource->_resId, resource->_filename.c_str());
 
diff --git a/engines/illusions/resources/backgroundresource.h b/engines/illusions/resources/backgroundresource.h
index 03266180d2a..0b57d5f681f 100644
--- a/engines/illusions/resources/backgroundresource.h
+++ b/engines/illusions/resources/backgroundresource.h
@@ -183,6 +183,7 @@ const uint kMaxBackgroundItemSurfaces = 3;
 class BackgroundInstance : public ResourceInstance {
 public:
 	BackgroundInstance(IllusionsEngine *vm);
+	~BackgroundInstance();
 	void load(Resource *resource) override;
 	void unload() override;
 	void pause() override;


Commit: e23ce9acc93ee70285d6c3d275660aca175e8d9c
    https://github.com/scummvm/scummvm/commit/e23ce9acc93ee70285d6c3d275660aca175e8d9c
Author: sluicebox (22204938+sluicebox at users.noreply.github.com)
Date: 2024-10-01T09:30:02-06:00

Commit Message:
ILLUSIONS: Fix memory leaks in FontResource

Changed paths:
    engines/illusions/resources/fontresource.cpp
    engines/illusions/resources/fontresource.h


diff --git a/engines/illusions/resources/fontresource.cpp b/engines/illusions/resources/fontresource.cpp
index f08c190f6d0..6e77701263b 100644
--- a/engines/illusions/resources/fontresource.cpp
+++ b/engines/illusions/resources/fontresource.cpp
@@ -51,6 +51,13 @@ void CharInfo::load(byte *dataStart, Common::SeekableReadStream &stream) {
 
 // CharRange
 
+CharRange::CharRange() : _charInfos(nullptr) {
+}
+
+CharRange::~CharRange() {
+	delete[] _charInfos;
+}
+
 void CharRange::load(byte *dataStart, Common::SeekableReadStream &stream) {
 	_firstChar = stream.readUint16LE();
 	_lastChar = stream.readUint16LE();
@@ -75,10 +82,11 @@ bool CharRange::containsChar(uint16 c) {
 
 // FontResource
 
-FontResource::FontResource() {
+FontResource::FontResource() : _charRanges(nullptr) {
 }
 
 FontResource::~FontResource() {
+	delete[] _charRanges;
 }
 
 void FontResource::load(Resource *resource) {
diff --git a/engines/illusions/resources/fontresource.h b/engines/illusions/resources/fontresource.h
index b579155baa8..66ae5f6b67f 100644
--- a/engines/illusions/resources/fontresource.h
+++ b/engines/illusions/resources/fontresource.h
@@ -47,6 +47,8 @@ struct CharInfo {
 };
 
 struct CharRange {
+	CharRange();
+	~CharRange();
 	uint16 _firstChar;
 	uint16 _lastChar;
 	CharInfo *_charInfos;


Commit: 61e25cf7800c206538d860e10b7b4124ffa9fb7f
    https://github.com/scummvm/scummvm/commit/61e25cf7800c206538d860e10b7b4124ffa9fb7f
Author: sluicebox (22204938+sluicebox at users.noreply.github.com)
Date: 2024-10-01T09:30:45-06:00

Commit Message:
ILLUSIONS: Fix resource memory leaks on exit

Changed paths:
    engines/illusions/bbdou/illusions_bbdou.cpp
    engines/illusions/duckman/illusions_duckman.cpp
    engines/illusions/resourcesystem.cpp
    engines/illusions/resourcesystem.h


diff --git a/engines/illusions/bbdou/illusions_bbdou.cpp b/engines/illusions/bbdou/illusions_bbdou.cpp
index 9d78ffa35c3..821f5cc9d1c 100644
--- a/engines/illusions/bbdou/illusions_bbdou.cpp
+++ b/engines/illusions/bbdou/illusions_bbdou.cpp
@@ -231,6 +231,8 @@ Common::Error IllusionsEngine_BBDOU::run() {
 
 	unloadSpecialCode(0);
 
+	_resSys->unloadAllResources();
+
 	delete _stack;
 	delete _scriptOpcodes;
 
diff --git a/engines/illusions/duckman/illusions_duckman.cpp b/engines/illusions/duckman/illusions_duckman.cpp
index 61f9dcef3d2..65e29efa45f 100644
--- a/engines/illusions/duckman/illusions_duckman.cpp
+++ b/engines/illusions/duckman/illusions_duckman.cpp
@@ -213,6 +213,7 @@ Common::Error IllusionsEngine_Duckman::run() {
 	_resSys->unloadResourceById(0x120002);
 	_resSys->unloadResourceById(0x120003);
 	_resSys->unloadResourceById(0x000D0001);
+	_resSys->unloadAllResources();
 
 	delete _stack;
 	delete _scriptOpcodes;
diff --git a/engines/illusions/resourcesystem.cpp b/engines/illusions/resourcesystem.cpp
index 4f5bbfdcf19..279f5918433 100644
--- a/engines/illusions/resourcesystem.cpp
+++ b/engines/illusions/resourcesystem.cpp
@@ -125,6 +125,13 @@ void ResourceSystem::unloadSceneResources(uint32 sceneId1, uint32 sceneId2) {
 	}
 }
 
+void ResourceSystem::unloadAllResources() {
+	for (ResourcesArrayIterator it = _resources.begin(); it != _resources.end(); ++it) {
+		delete (*it);
+	}
+	_resources.clear();
+}
+
 BaseResourceLoader *ResourceSystem::getResourceLoader(uint32 resId) {
 	ResourceLoadersMapIterator it = _resourceLoaders.find(ResourceTypeId(resId));
 	if (it != _resourceLoaders.end())
diff --git a/engines/illusions/resourcesystem.h b/engines/illusions/resourcesystem.h
index 67aee4fceb8..41e8c8fd35f 100644
--- a/engines/illusions/resourcesystem.h
+++ b/engines/illusions/resourcesystem.h
@@ -93,6 +93,7 @@ public:
 	void unloadResourceById(uint32 resId);
 	void unloadResourcesBySceneId(uint32 sceneId);
 	void unloadSceneResources(uint32 sceneId1, uint32 sceneId2);
+	void unloadAllResources();
 	Resource *getResource(uint32 resId);
 
 protected:




More information about the Scummvm-git-logs mailing list