[Scummvm-cvs-logs] SF.net SVN: scummvm: [28483] scummvm/trunk/engines/parallaction
peres001 at users.sourceforge.net
peres001 at users.sourceforge.net
Tue Aug 7 16:53:58 CEST 2007
Revision: 28483
http://scummvm.svn.sourceforge.net/scummvm/?rev=28483&view=rev
Author: peres001
Date: 2007-08-07 07:53:58 -0700 (Tue, 07 Aug 2007)
Log Message:
-----------
MaskBuffer and PathBuffer are now correctly freed before they are deallocated, and so is background Surface.
Modified Paths:
--------------
scummvm/trunk/engines/parallaction/graphics.cpp
scummvm/trunk/engines/parallaction/graphics.h
scummvm/trunk/engines/parallaction/parallaction.cpp
scummvm/trunk/engines/parallaction/walk.cpp
scummvm/trunk/engines/parallaction/walk.h
Modified: scummvm/trunk/engines/parallaction/graphics.cpp
===================================================================
--- scummvm/trunk/engines/parallaction/graphics.cpp 2007-08-07 14:05:39 UTC (rev 28482)
+++ scummvm/trunk/engines/parallaction/graphics.cpp 2007-08-07 14:53:58 UTC (rev 28483)
@@ -772,16 +772,20 @@
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() {
- _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];
Modified: scummvm/trunk/engines/parallaction/graphics.h
===================================================================
--- scummvm/trunk/engines/parallaction/graphics.h 2007-08-07 14:05:39 UTC (rev 28482)
+++ scummvm/trunk/engines/parallaction/graphics.h 2007-08-07 14:53:58 UTC (rev 28483)
@@ -156,13 +156,9 @@
byte *data;
public:
- MaskBuffer() : w(0), internalWidth(0), h(0), data(0) {
+ MaskBuffer() : w(0), internalWidth(0), h(0), size(0), data(0) {
}
- ~MaskBuffer() {
- free();
- }
-
void create(uint16 width, uint16 height) {
w = width;
internalWidth = w >> 2;
@@ -174,6 +170,11 @@
void free() {
if (data)
::free(data);
+ data = 0;
+ w = 0;
+ h = 0;
+ internalWidth = 0;
+ size = 0;
}
inline byte getValue(uint16 x, uint16 y) {
Modified: scummvm/trunk/engines/parallaction/parallaction.cpp
===================================================================
--- scummvm/trunk/engines/parallaction/parallaction.cpp 2007-08-07 14:05:39 UTC (rev 28482)
+++ scummvm/trunk/engines/parallaction/parallaction.cpp 2007-08-07 14:53:58 UTC (rev 28483)
@@ -131,8 +131,10 @@
delete _zoneTypeNames;
delete _zoneFlagNames;
- if (_pathBuffer)
+ if (_pathBuffer) {
+ _pathBuffer->free();
delete _pathBuffer;
+ }
_animations.remove(&_char._ani);
Modified: scummvm/trunk/engines/parallaction/walk.cpp
===================================================================
--- scummvm/trunk/engines/parallaction/walk.cpp 2007-08-07 14:05:39 UTC (rev 28482)
+++ scummvm/trunk/engines/parallaction/walk.cpp 2007-08-07 14:53:58 UTC (rev 28483)
@@ -422,8 +422,10 @@
void Parallaction::setPath(PathBuffer *buffer) {
- if (_pathBuffer)
+ if (_pathBuffer) {
+ _pathBuffer->free();
delete _pathBuffer;
+ }
_pathBuffer = buffer;
}
Modified: scummvm/trunk/engines/parallaction/walk.h
===================================================================
--- scummvm/trunk/engines/parallaction/walk.h 2007-08-07 14:05:39 UTC (rev 28482)
+++ scummvm/trunk/engines/parallaction/walk.h 2007-08-07 14:53:58 UTC (rev 28483)
@@ -60,13 +60,9 @@
byte *data;
public:
- PathBuffer() : w(0), internalWidth(0), h(0), data(0) {
+ PathBuffer() : w(0), internalWidth(0), h(0), size(0), data(0) {
}
- ~PathBuffer() {
- free();
- }
-
void create(uint16 width, uint16 height) {
w = width;
internalWidth = w >> 3;
@@ -78,6 +74,11 @@
void free() {
if (data)
::free(data);
+ data = 0;
+ w = 0;
+ h = 0;
+ internalWidth = 0;
+ size = 0;
}
inline byte getValue(uint16 x, uint16 y);
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
More information about the Scummvm-git-logs
mailing list