diff options
Diffstat (limited to 'engines/glk')
-rw-r--r-- | engines/glk/selection.cpp | 4 | ||||
-rw-r--r-- | engines/glk/streams.cpp | 10 | ||||
-rw-r--r-- | engines/glk/streams.h | 5 |
3 files changed, 15 insertions, 4 deletions
diff --git a/engines/glk/selection.cpp b/engines/glk/selection.cpp index f251171736..91097768ba 100644 --- a/engines/glk/selection.cpp +++ b/engines/glk/selection.cpp @@ -72,10 +72,10 @@ WindowMask::~WindowMask() { void WindowMask::clear() { for (size_t i = 0; i < _hor; i++) { if (_links[i]) - delete _links[i]; + delete[] _links[i]; } - delete _links; + delete[] _links; } void WindowMask::resize(size_t x, size_t y) { diff --git a/engines/glk/streams.cpp b/engines/glk/streams.cpp index 801cd549a8..cd7130fb35 100644 --- a/engines/glk/streams.cpp +++ b/engines/glk/streams.cpp @@ -75,6 +75,10 @@ void Stream::setReverseVideo(bool reverse) { /*--------------------------------------------------------------------------*/ +WindowStream::~WindowStream() { + _window->_stream = nullptr; +} + void WindowStream::close(StreamResult *result) { warning("cannot close window stream"); } @@ -1407,8 +1411,10 @@ Streams::Streams() : _streamList(nullptr), _currentStream(nullptr) { } Streams::~Streams() { - while (_streamList) - delete _streamList; + for (Stream *currStream = _streamList, *nextStream; currStream; currStream = nextStream) { + nextStream = currStream->_next; + delete currStream; + } } FileStream *Streams::openFileStream(frefid_t fref, glui32 fmode, glui32 rock, bool unicode) { diff --git a/engines/glk/streams.h b/engines/glk/streams.h index 32bde70887..22a0a59602 100644 --- a/engines/glk/streams.h +++ b/engines/glk/streams.h @@ -300,6 +300,11 @@ public: Stream(streams, false, true, rock, unicode), _window(window) {} /** + * Destructor + */ + virtual ~WindowStream(); + + /** * Close the stream */ virtual void close(StreamResult *result = nullptr); |