[Scummvm-cvs-logs] scummvm master -> 0f39a4367535fcd4bfa4c41340d90d7856d086d8
bluegr
md5 at scummvm.org
Sun Jan 15 17:36:23 CET 2012
This automated email contains information about 2 new commits which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .
Summary:
780b2eff16 SCI: Plug a leak in ResourceManager::detectSciVersion()
0f39a43675 SCI: Plug loads of memory leaks in the SCI32 graphics code
Commit: 780b2eff1636985b900db6d0908cc6d3d395f409
https://github.com/scummvm/scummvm/commit/780b2eff1636985b900db6d0908cc6d3d395f409
Author: Filippos Karapetis (md5 at scummvm.org)
Date: 2012-01-15T08:34:41-08:00
Commit Message:
SCI: Plug a leak in ResourceManager::detectSciVersion()
Many thanks to digitall for finding this one
Changed paths:
engines/sci/resource.cpp
diff --git a/engines/sci/resource.cpp b/engines/sci/resource.cpp
index 9171e5e..c3bd03b 100644
--- a/engines/sci/resource.cpp
+++ b/engines/sci/resource.cpp
@@ -2200,13 +2200,16 @@ void ResourceManager::detectSciVersion() {
// Handle SCI32 versions here
if (_volVersion >= kResVersionSci2) {
Common::List<ResourceId> *heaps = listResources(kResourceTypeHeap);
+ bool hasHeapResources = !heaps->empty();
+ delete heaps;
+
// SCI2.1/3 and SCI1 Late resource maps are the same, except that
// SCI1 Late resource maps have the resource types or'd with
// 0x80. We differentiate between SCI2 and SCI2.1/3 based on that.
if (_mapVersion == kResVersionSci1Late) {
s_sciVersion = SCI_VERSION_2;
return;
- } else if (!heaps->empty()) {
+ } else if (hasHeapResources) {
s_sciVersion = SCI_VERSION_2_1;
return;
} else {
Commit: 0f39a4367535fcd4bfa4c41340d90d7856d086d8
https://github.com/scummvm/scummvm/commit/0f39a4367535fcd4bfa4c41340d90d7856d086d8
Author: Filippos Karapetis (md5 at scummvm.org)
Date: 2012-01-15T08:35:33-08:00
Commit Message:
SCI: Plug loads of memory leaks in the SCI32 graphics code
Many thanks to digitall for finding these
Changed paths:
engines/sci/graphics/frameout.cpp
diff --git a/engines/sci/graphics/frameout.cpp b/engines/sci/graphics/frameout.cpp
index e3fac80..b12413a 100644
--- a/engines/sci/graphics/frameout.cpp
+++ b/engines/sci/graphics/frameout.cpp
@@ -61,12 +61,13 @@ GfxFrameout::GfxFrameout(SegManager *segMan, ResourceManager *resMan, GfxCoordAd
}
GfxFrameout::~GfxFrameout() {
+ clear();
}
void GfxFrameout::clear() {
- _screenItems.clear();
+ deletePlaneItems(NULL_REG);
_planes.clear();
- _planePictures.clear();
+ deletePlanePictures(NULL_REG);
}
void GfxFrameout::kernelAddPlane(reg_t object) {
@@ -214,12 +215,15 @@ void GfxFrameout::addPlanePicture(reg_t object, GuiResourceId pictureId, uint16
}
void GfxFrameout::deletePlanePictures(reg_t object) {
- for (PlanePictureList::iterator it = _planePictures.begin(); it != _planePictures.end(); it++) {
- if (it->object == object) {
+ PlanePictureList::iterator it = _planePictures.begin();
+
+ while (it != _planePictures.end()) {
+ if (it->object == object || object.isNull()) {
+ delete it->pictureCels;
delete it->picture;
- _planePictures.erase(it);
- deletePlanePictures(object);
- return;
+ it = _planePictures.erase(it);
+ } else {
+ ++it;
}
}
}
@@ -272,17 +276,28 @@ void GfxFrameout::kernelDeleteScreenItem(reg_t object) {
}
_screenItems.remove(itemEntry);
+ delete itemEntry;
}
void GfxFrameout::deletePlaneItems(reg_t planeObject) {
FrameoutList::iterator listIterator = _screenItems.begin();
while (listIterator != _screenItems.end()) {
- reg_t itemPlane = readSelector(_segMan, (*listIterator)->object, SELECTOR(plane));
- if (planeObject == itemPlane)
+ bool objectMatches = false;
+ if (!planeObject.isNull()) {
+ reg_t itemPlane = readSelector(_segMan, (*listIterator)->object, SELECTOR(plane));
+ objectMatches = (planeObject == itemPlane);
+ } else {
+ objectMatches = true;
+ }
+
+ if (objectMatches) {
+ FrameoutEntry *itemEntry = *listIterator;
listIterator = _screenItems.erase(listIterator);
- else
+ delete itemEntry;
+ } else {
++listIterator;
+ }
}
}
More information about the Scummvm-git-logs
mailing list