diff options
author | Eugene Sandulenko | 2020-01-06 13:40:24 +0100 |
---|---|---|
committer | Eugene Sandulenko | 2020-01-06 13:40:24 +0100 |
commit | 0d7d1ed2f8335a6423e287efb9c253908e53f3c5 (patch) | |
tree | a695c69196bc1c815457c3fbe66e8ffbbec9af48 /engines | |
parent | 6ce6922eef47b4a1a56b7f514937e1cae05ebbd1 (diff) | |
download | scummvm-rg350-0d7d1ed2f8335a6423e287efb9c253908e53f3c5.tar.gz scummvm-rg350-0d7d1ed2f8335a6423e287efb9c253908e53f3c5.tar.bz2 scummvm-rg350-0d7d1ed2f8335a6423e287efb9c253908e53f3c5.zip |
DIRECTOR: Plug memory leak in Cast
Diffstat (limited to 'engines')
-rw-r--r-- | engines/director/cast.cpp | 21 | ||||
-rw-r--r-- | engines/director/cast.h | 5 |
2 files changed, 19 insertions, 7 deletions
diff --git a/engines/director/cast.cpp b/engines/director/cast.cpp index 825c3b2093..4537742e19 100644 --- a/engines/director/cast.cpp +++ b/engines/director/cast.cpp @@ -21,6 +21,7 @@ */ #include "common/substream.h" +#include "graphics/surface.h" #include "director/director.h" #include "director/cachedmactext.h" @@ -30,6 +31,17 @@ namespace Director { +Cast::Cast() { + _type = kCastTypeNull; + _surface = nullptr; + + _modified = true; +} + +Cast::~Cast() { + delete _surface; +} + BitmapCast::BitmapCast(Common::ReadStreamEndian &stream, uint32 castTag, uint16 version) { _type = kCastBitmap; @@ -106,7 +118,6 @@ BitmapCast::BitmapCast(Common::ReadStreamEndian &stream, uint32 castTag, uint16 stream.readUint32(); } - _modified = 0; _tag = castTag; } @@ -223,10 +234,10 @@ TextCast::TextCast(Common::ReadStreamEndian &stream, uint16 version) { stream.readUint16(); } - _modified = 0; - _cachedMacText = new CachedMacText(this, version, -1, g_director->_wm); // TODO Destroy me + + _modified = false; } void TextCast::importStxt(const Stxt *stxt) { @@ -305,7 +316,7 @@ ShapeCast::ShapeCast(Common::ReadStreamEndian &stream, uint16 version) { _lineThickness = 1; _lineDirection = 0; } - _modified = 0; + _modified = false; debugC(3, kDebugLoading, "ShapeCast: fl: %x unk1: %x type: %d pat: %d fg: %d bg: %d fill: %d thick: %d dir: %d", flags, unk1, _shapeType, _pattern, _fgCol, _bgCol, _fillType, _lineThickness, _lineDirection); @@ -329,7 +340,6 @@ ButtonCast::ButtonCast(Common::ReadStreamEndian &stream, uint16 version) : TextC _buttonType = static_cast<ButtonType>(stream.readUint16BE()); } - _modified = 0; } ScriptCast::ScriptCast(Common::ReadStreamEndian &stream, uint16 version) { @@ -363,7 +373,6 @@ ScriptCast::ScriptCast(Common::ReadStreamEndian &stream, uint16 version) { // WIP need to complete this! } - _modified = 0; } RTECast::RTECast(Common::ReadStreamEndian &stream, uint16 version) : TextCast(stream, version) { diff --git a/engines/director/cast.h b/engines/director/cast.h index 3d8db523c7..3e1479d041 100644 --- a/engines/director/cast.h +++ b/engines/director/cast.h @@ -42,6 +42,9 @@ class CachedMacText; class Cast { public: + Cast(); + virtual ~Cast(); + CastType _type; Common::Rect _initialRect; Common::Rect _boundingRect; @@ -49,7 +52,7 @@ public: const Graphics::Surface *_surface; - byte _modified; + bool _modified; }; class BitmapCast : public Cast { |