diff options
author | Paul Gilbert | 2018-11-17 20:06:33 -0800 |
---|---|---|
committer | Paul Gilbert | 2018-12-08 19:05:59 -0800 |
commit | 0167d988fae3a54f526e004ac866db6636307f6f (patch) | |
tree | 720be2dc5abe84bd097e58341c6b2e726ede462c /engines | |
parent | fc86b3705bf2e46f03e27ed7b3934bc4b306a3a2 (diff) | |
download | scummvm-rg350-0167d988fae3a54f526e004ac866db6636307f6f.tar.gz scummvm-rg350-0167d988fae3a54f526e004ac866db6636307f6f.tar.bz2 scummvm-rg350-0167d988fae3a54f526e004ac866db6636307f6f.zip |
GLK: Free windows on exit
Diffstat (limited to 'engines')
-rw-r--r-- | engines/glk/window_pair.cpp | 5 | ||||
-rw-r--r-- | engines/glk/window_pair.h | 5 | ||||
-rw-r--r-- | engines/glk/windows.cpp | 10 |
3 files changed, 19 insertions, 1 deletions
diff --git a/engines/glk/window_pair.cpp b/engines/glk/window_pair.cpp index a0fdbb440b..41b4e20a10 100644 --- a/engines/glk/window_pair.cpp +++ b/engines/glk/window_pair.cpp @@ -38,6 +38,11 @@ PairWindow::PairWindow(Windows *windows, glui32 method, Window *key, glui32 size _type = wintype_Pair; } +PairWindow::~PairWindow() { + delete _child1; + delete _child2; +} + void PairWindow::rearrange(const Rect &box) { Rect box1, box2; int min, diff, split, splitwid, max; diff --git a/engines/glk/window_pair.h b/engines/glk/window_pair.h index f77ae9243b..dabae775cf 100644 --- a/engines/glk/window_pair.h +++ b/engines/glk/window_pair.h @@ -49,6 +49,11 @@ public: PairWindow(Windows *windows, glui32 method, Window *key, glui32 size); /** + * Destructor + */ + ~PairWindow(); + + /** * Rearranges the window */ virtual void rearrange(const Rect &box) override; diff --git a/engines/glk/windows.cpp b/engines/glk/windows.cpp index ce1929fedf..4db231c530 100644 --- a/engines/glk/windows.cpp +++ b/engines/glk/windows.cpp @@ -509,12 +509,20 @@ Window::~Window() { if (g_vm->gli_unregister_obj) (*g_vm->gli_unregister_obj)(this, gidisp_Class_Window, _dispRock); - + // Remove the window from any parent + PairWindow *parent = dynamic_cast<PairWindow *>(_parent); + if (parent && parent->_child1 == this) + parent->_child1 = nullptr; + if (parent && parent->_child2 == this) + parent->_child2 = nullptr; + + // Delete any attached window stream _echoStream = nullptr; delete _stream; delete[] _lineTerminatorsBase; + // Remove the window from the master list of windows Window *prev = _prev; Window *next = _next; |