aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEugene Sandulenko2016-12-13 18:15:41 +0100
committerEugene Sandulenko2016-12-13 18:15:41 +0100
commita62d29ab86b6c149051296adeb5c2be3812daac0 (patch)
tree6ff56cbb694abd02259dc917cdce32036468a4cf
parentd239461726fdad7441056c3c037b82fc1af36414 (diff)
downloadscummvm-rg350-a62d29ab86b6c149051296adeb5c2be3812daac0.tar.gz
scummvm-rg350-a62d29ab86b6c149051296adeb5c2be3812daac0.tar.bz2
scummvm-rg350-a62d29ab86b6c149051296adeb5c2be3812daac0.zip
FULLPIPE: Revert memory leak fixing as that introduced tons of regressions
-rw-r--r--engines/fullpipe/fullpipe.cpp3
-rw-r--r--engines/fullpipe/gameloader.cpp34
-rw-r--r--engines/fullpipe/gameloader.h1
-rw-r--r--engines/fullpipe/gfx.cpp23
-rw-r--r--engines/fullpipe/gfx.h1
-rw-r--r--engines/fullpipe/input.cpp3
-rw-r--r--engines/fullpipe/motion.cpp5
-rw-r--r--engines/fullpipe/motion.h1
-rw-r--r--engines/fullpipe/statesaver.cpp2
-rw-r--r--engines/fullpipe/statics.cpp6
10 files changed, 22 insertions, 57 deletions
diff --git a/engines/fullpipe/fullpipe.cpp b/engines/fullpipe/fullpipe.cpp
index 41a4251fe9..10c1744dd9 100644
--- a/engines/fullpipe/fullpipe.cpp
+++ b/engines/fullpipe/fullpipe.cpp
@@ -214,9 +214,6 @@ FullpipeEngine::~FullpipeEngine() {
delete _soundStream2;
delete _soundStream3;
delete _soundStream4;
- delete _floaters;
- delete _aniHandler;
- delete _behaviorManager;
}
void FullpipeEngine::initialize() {
diff --git a/engines/fullpipe/gameloader.cpp b/engines/fullpipe/gameloader.cpp
index 28a3964285..aebf73dbe4 100644
--- a/engines/fullpipe/gameloader.cpp
+++ b/engines/fullpipe/gameloader.cpp
@@ -85,6 +85,23 @@ GameLoader::~GameLoader() {
g_fp->_gameLoader = 0;
+ for (uint i = 0; i < _sc2array.size(); i++) {
+ if (_sc2array[i]._defPicAniInfos)
+ free(_sc2array[i]._defPicAniInfos);
+
+ if (_sc2array[i]._picAniInfos)
+ free(_sc2array[i]._picAniInfos);
+
+ if (_sc2array[i]._motionController)
+ delete _sc2array[i]._motionController;
+
+ if (_sc2array[i]._data1)
+ free(_sc2array[i]._data1);
+
+ if (_sc2array[i]._entranceData)
+ free(_sc2array[i]._entranceData);
+ }
+
delete _gameVar;
_gameVar = 0;
@@ -600,23 +617,6 @@ Sc2::Sc2() {
_entranceDataCount = 0;
}
-Sc2::~Sc2() {
- delete _motionController;
- free(_data1);
-
- for (int i = 0; i < _defPicAniInfosCount; i++)
- delete _defPicAniInfos[i];
- free(_defPicAniInfos);
-
- for (int i = 0; i < _entranceDataCount; i++)
- delete _entranceData[i];
- free(_entranceData);
-
- for (int i = 0; i < _picAniInfosCount; i++)
- delete _picAniInfos[i];
- free(_picAniInfos);
-}
-
bool Sc2::load(MfcArchive &file) {
debugC(5, kDebugLoading, "Sc2::load()");
diff --git a/engines/fullpipe/gameloader.h b/engines/fullpipe/gameloader.h
index 52811d8624..a6c2416aae 100644
--- a/engines/fullpipe/gameloader.h
+++ b/engines/fullpipe/gameloader.h
@@ -57,7 +57,6 @@ class Sc2 : public CObject {
public:
Sc2();
- virtual ~Sc2();
virtual bool load(MfcArchive &file);
};
diff --git a/engines/fullpipe/gfx.cpp b/engines/fullpipe/gfx.cpp
index 0f9ac80e1e..4dec4b640c 100644
--- a/engines/fullpipe/gfx.cpp
+++ b/engines/fullpipe/gfx.cpp
@@ -45,9 +45,6 @@ Background::Background() {
}
Background::~Background() {
- for (uint i = 1; i < _picObjList.size(); i++)
- delete _picObjList[i];
-
_picObjList.clear();
for (int i = 0; i < _bigPictureArray1Count; i++) {
@@ -58,8 +55,6 @@ Background::~Background() {
}
free(_bigPictureArray);
-
- free(_bgname);
}
bool Background::load(MfcArchive &file) {
@@ -483,13 +478,12 @@ void Picture::freePicture() {
if (_bitmap) {
if (testFlags() && !_field_54) {
freeData();
- delete _bitmap;
+ //free(_bitmap);
_bitmap = 0;
}
}
if (_bitmap) {
- delete _bitmap;
_bitmap = 0;
_data = 0;
}
@@ -607,8 +601,6 @@ void Picture::getDibInfo() {
_bitmap->decode((int32 *)(_paletteData ? _paletteData : g_fp->_globalPalette));
_bitmap->_pixels = 0;
-
- delete s;
}
Bitmap *Picture::getPixelData() {
@@ -779,8 +771,6 @@ Bitmap::Bitmap() {
_flags = 0;
_surface = 0;
_flipping = Graphics::FLIP_NONE;
-
- _skipDelete = false;
}
Bitmap::Bitmap(Bitmap *src) {
@@ -794,21 +784,14 @@ Bitmap::Bitmap(Bitmap *src) {
_pixels = src->_pixels;
_surface = new Graphics::TransparentSurface(*src->_surface);
_flipping = src->_flipping;
-
- _skipDelete = true;
}
Bitmap::~Bitmap() {
if (_pixels)
free(_pixels);
- if (!_skipDelete) {
- if (_surface)
- _surface->free();
- delete _surface;
- }
-
- _surface = 0;
+ _surface->free();
+ delete _surface;
_pixels = 0;
}
diff --git a/engines/fullpipe/gfx.h b/engines/fullpipe/gfx.h
index f8396c98cf..566586fb48 100644
--- a/engines/fullpipe/gfx.h
+++ b/engines/fullpipe/gfx.h
@@ -40,7 +40,6 @@ struct Bitmap {
int _flags;
Graphics::TransparentSurface *_surface;
int _flipping;
- bool _skipDelete;
Bitmap();
Bitmap(Bitmap *src);
diff --git a/engines/fullpipe/input.cpp b/engines/fullpipe/input.cpp
index 4bcc2acc17..55735624c6 100644
--- a/engines/fullpipe/input.cpp
+++ b/engines/fullpipe/input.cpp
@@ -56,9 +56,6 @@ InputController::~InputController() {
removeMessageHandler(126, -1);
g_fp->_inputController = 0;
-
- for (uint i = 0; i < _cursorsArray.size(); i++)
- delete _cursorsArray[i];
}
void InputController::setInputDisabled(bool state) {
diff --git a/engines/fullpipe/motion.cpp b/engines/fullpipe/motion.cpp
index 13fe8d03c1..05f13d4a8b 100644
--- a/engines/fullpipe/motion.cpp
+++ b/engines/fullpipe/motion.cpp
@@ -105,11 +105,6 @@ MovGraphLink *MotionController::getLinkByName(const char *name) {
return 0;
}
-MctlCompound::~MctlCompound() {
- for (uint i = 0; i < _motionControllers.size(); i++)
- delete _motionControllers[i];
-}
-
bool MctlCompound::load(MfcArchive &file) {
debugC(5, kDebugLoading, "MctlCompound::load()");
diff --git a/engines/fullpipe/motion.h b/engines/fullpipe/motion.h
index d1c5901807..4eecd98536 100644
--- a/engines/fullpipe/motion.h
+++ b/engines/fullpipe/motion.h
@@ -106,7 +106,6 @@ public:
MctlCompoundArray _motionControllers;
MctlCompound() { _objtype = kObjTypeMctlCompound; }
- virtual ~MctlCompound();
virtual bool load(MfcArchive &file);
diff --git a/engines/fullpipe/statesaver.cpp b/engines/fullpipe/statesaver.cpp
index 5eb08fe213..7fb56f0479 100644
--- a/engines/fullpipe/statesaver.cpp
+++ b/engines/fullpipe/statesaver.cpp
@@ -55,7 +55,7 @@ bool GameLoader::writeSavegame(Scene *sc, const char *fname) {
header.updateCounter = _updateCounter;
header.unkField = 1;
- Common::MemoryWriteStreamDynamic stream(DisposeAfterUse::YES);
+ Common::MemoryWriteStreamDynamic stream;
MfcArchive *archive = new MfcArchive(&stream);
diff --git a/engines/fullpipe/statics.cpp b/engines/fullpipe/statics.cpp
index cc94f543de..ece4f43e9f 100644
--- a/engines/fullpipe/statics.cpp
+++ b/engines/fullpipe/statics.cpp
@@ -154,8 +154,6 @@ StaticANIObject::~StaticANIObject() {
_staticsList.clear();
- freeMovementsPixelData();
-
for (uint i = 0; i < _movements.size(); i++)
delete _movements[i];
@@ -574,8 +572,6 @@ void Movement::draw(bool flipFlag, int angle) {
}
}
}
-
- delete bmp;
}
void StaticANIObject::loadMovementsPixelData() {
@@ -1543,7 +1539,7 @@ Movement::~Movement() {
for (uint i = 0; i < _dynamicPhases.size(); i++)
delete _framePosOffsets[i];
- if (!_currMovement) {
+ if (!_currMovement ) {
if (_updateFlag1)
_dynamicPhases.remove_at(0);