diff options
author | Nicola Mettifogo | 2007-08-07 14:53:58 +0000 |
---|---|---|
committer | Nicola Mettifogo | 2007-08-07 14:53:58 +0000 |
commit | d30c3650a358e4e5ba8a548d4e218d7b49fba34a (patch) | |
tree | d0ad1727c50257b815cafe8cdeff69d55cb0f106 /engines/parallaction | |
parent | 66c0a57248d873f744ae928d28a7161fcf1d68f0 (diff) | |
download | scummvm-rg350-d30c3650a358e4e5ba8a548d4e218d7b49fba34a.tar.gz scummvm-rg350-d30c3650a358e4e5ba8a548d4e218d7b49fba34a.tar.bz2 scummvm-rg350-d30c3650a358e4e5ba8a548d4e218d7b49fba34a.zip |
MaskBuffer and PathBuffer are now correctly freed before they are deallocated, and so is background Surface.
svn-id: r28483
Diffstat (limited to 'engines/parallaction')
-rw-r--r-- | engines/parallaction/graphics.cpp | 18 | ||||
-rw-r--r-- | engines/parallaction/graphics.h | 11 | ||||
-rw-r--r-- | engines/parallaction/parallaction.cpp | 4 | ||||
-rw-r--r-- | engines/parallaction/walk.cpp | 4 | ||||
-rw-r--r-- | engines/parallaction/walk.h | 11 |
5 files changed, 31 insertions, 17 deletions
diff --git a/engines/parallaction/graphics.cpp b/engines/parallaction/graphics.cpp index e948fa7f26..5c31c87d7a 100644 --- a/engines/parallaction/graphics.cpp +++ b/engines/parallaction/graphics.cpp @@ -772,16 +772,20 @@ void Gfx::freeStaticCnv(StaticCnv *cnv) { void Gfx::setBackground(Graphics::Surface *surface) { - if (_buffers[kBit2]) + if (_buffers[kBit2]) { + _buffers[kBit2]->free(); delete _buffers[kBit2]; + } _buffers[kBit2] = surface; copyScreen(kBit2, kBitBack); } void Gfx::setMask(MaskBuffer *buffer) { - if (_depthMask) + if (_depthMask) { + _depthMask->free(); delete _depthMask; + } _depthMask = buffer; } @@ -893,16 +897,20 @@ Gfx::Gfx(Parallaction* vm) : Gfx::~Gfx() { - _depthMask->free(); - delete _depthMask; + if (_depthMask) { + _depthMask->free(); + delete _depthMask; + } _buffers[kBitFront]->free(); delete _buffers[kBitFront]; _buffers[kBitBack]->free(); delete _buffers[kBitBack]; - if (_buffers[kBit2]) + if (_buffers[kBit2]) { + _buffers[kBit2]->free(); delete _buffers[kBit2]; + } delete _fonts[kFontDialogue]; delete _fonts[kFontLabel]; diff --git a/engines/parallaction/graphics.h b/engines/parallaction/graphics.h index 30c56689df..9f7d2ffd6d 100644 --- a/engines/parallaction/graphics.h +++ b/engines/parallaction/graphics.h @@ -156,11 +156,7 @@ struct MaskBuffer { byte *data; public: - MaskBuffer() : w(0), internalWidth(0), h(0), data(0) { - } - - ~MaskBuffer() { - free(); + MaskBuffer() : w(0), internalWidth(0), h(0), size(0), data(0) { } void create(uint16 width, uint16 height) { @@ -174,6 +170,11 @@ public: void free() { if (data) ::free(data); + data = 0; + w = 0; + h = 0; + internalWidth = 0; + size = 0; } inline byte getValue(uint16 x, uint16 y) { diff --git a/engines/parallaction/parallaction.cpp b/engines/parallaction/parallaction.cpp index a3dfd90a07..51b832062c 100644 --- a/engines/parallaction/parallaction.cpp +++ b/engines/parallaction/parallaction.cpp @@ -131,8 +131,10 @@ Parallaction::~Parallaction() { delete _zoneTypeNames; delete _zoneFlagNames; - if (_pathBuffer) + if (_pathBuffer) { + _pathBuffer->free(); delete _pathBuffer; + } _animations.remove(&_char._ani); diff --git a/engines/parallaction/walk.cpp b/engines/parallaction/walk.cpp index 9a306b4f4e..281f2388e4 100644 --- a/engines/parallaction/walk.cpp +++ b/engines/parallaction/walk.cpp @@ -422,8 +422,10 @@ void jobWalk(void *parm, Job *j) { void Parallaction::setPath(PathBuffer *buffer) { - if (_pathBuffer) + if (_pathBuffer) { + _pathBuffer->free(); delete _pathBuffer; + } _pathBuffer = buffer; } diff --git a/engines/parallaction/walk.h b/engines/parallaction/walk.h index 77b359b03e..dcbc3d5aa9 100644 --- a/engines/parallaction/walk.h +++ b/engines/parallaction/walk.h @@ -60,11 +60,7 @@ struct PathBuffer { byte *data; public: - PathBuffer() : w(0), internalWidth(0), h(0), data(0) { - } - - ~PathBuffer() { - free(); + PathBuffer() : w(0), internalWidth(0), h(0), size(0), data(0) { } void create(uint16 width, uint16 height) { @@ -78,6 +74,11 @@ public: void free() { if (data) ::free(data); + data = 0; + w = 0; + h = 0; + internalWidth = 0; + size = 0; } inline byte getValue(uint16 x, uint16 y); |