FULLPIPE: Revert memory leak fixing as that introduced tons of regressions

This commit is contained in:
Eugene Sandulenko 2016-12-13 18:15:41 +01:00
parent d239461726
commit a62d29ab86
10 changed files with 22 additions and 57 deletions

View File

@ -214,9 +214,6 @@ FullpipeEngine::~FullpipeEngine() {
delete _soundStream2;
delete _soundStream3;
delete _soundStream4;
delete _floaters;
delete _aniHandler;
delete _behaviorManager;
}
void FullpipeEngine::initialize() {

View File

@ -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()");

View File

@ -57,7 +57,6 @@ class Sc2 : public CObject {
public:
Sc2();
virtual ~Sc2();
virtual bool load(MfcArchive &file);
};

View File

@ -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;
}

View File

@ -40,7 +40,6 @@ struct Bitmap {
int _flags;
Graphics::TransparentSurface *_surface;
int _flipping;
bool _skipDelete;
Bitmap();
Bitmap(Bitmap *src);

View File

@ -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) {

View File

@ -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()");

View File

@ -106,7 +106,6 @@ public:
MctlCompoundArray _motionControllers;
MctlCompound() { _objtype = kObjTypeMctlCompound; }
virtual ~MctlCompound();
virtual bool load(MfcArchive &file);

View File

@ -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);

View File

@ -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);