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/glk/windows.cpp | |
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/glk/windows.cpp')
-rw-r--r-- | engines/glk/windows.cpp | 10 |
1 files changed, 9 insertions, 1 deletions
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; |