aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--engines/glk/selection.cpp11
-rw-r--r--engines/glk/selection.h10
-rw-r--r--engines/glk/windows.cpp4
-rw-r--r--engines/glk/windows.h5
4 files changed, 28 insertions, 2 deletions
diff --git a/engines/glk/selection.cpp b/engines/glk/selection.cpp
index 566ae65345..f251171736 100644
--- a/engines/glk/selection.cpp
+++ b/engines/glk/selection.cpp
@@ -65,14 +65,21 @@ WindowMask::WindowMask() : _hor(0), _ver(0), _links(nullptr) {
resize(g_system->getWidth(), g_system->getHeight());
}
-void WindowMask::resize(size_t x, size_t y) {
- // Deallocate old storage
+WindowMask::~WindowMask() {
+ clear();
+}
+
+void WindowMask::clear() {
for (size_t i = 0; i < _hor; i++) {
if (_links[i])
delete _links[i];
}
delete _links;
+}
+
+void WindowMask::resize(size_t x, size_t y) {
+ clear();
_hor = x + 1;
_ver = y + 1;
diff --git a/engines/glk/selection.h b/engines/glk/selection.h
index 4497d68539..10d6d5cdec 100644
--- a/engines/glk/selection.h
+++ b/engines/glk/selection.h
@@ -63,6 +63,11 @@ public:
* Manages hyperlinks for the screen
*/
class WindowMask {
+private:
+ /**
+ * Clear the links data
+ */
+ void clear();
public:
size_t _hor, _ver;
glui32 **_links;
@@ -75,6 +80,11 @@ public:
WindowMask();
/**
+ * Destructor
+ */
+ ~WindowMask();
+
+ /**
* Resize the links array
*/
void resize(size_t x, size_t y);
diff --git a/engines/glk/windows.cpp b/engines/glk/windows.cpp
index 02298ad79e..ce1929fedf 100644
--- a/engines/glk/windows.cpp
+++ b/engines/glk/windows.cpp
@@ -70,6 +70,10 @@ Windows::Windows(Graphics::Screen *screen) : _screen(screen), _windowList(nullpt
_zcolor_Bright[0] = _zcolor_Bright[1] = _zcolor_Bright[2] = 0;
}
+Windows::~Windows() {
+ delete _rootWin;
+}
+
Window *Windows::windowOpen(Window *splitwin, glui32 method, glui32 size,
glui32 wintype, glui32 rock) {
Window *newwin, *oldparent;
diff --git a/engines/glk/windows.h b/engines/glk/windows.h
index 98f0d2d6df..7abb9e5ff5 100644
--- a/engines/glk/windows.h
+++ b/engines/glk/windows.h
@@ -152,6 +152,11 @@ public:
Windows(Graphics::Screen *screen);
/**
+ * Destructor
+ */
+ ~Windows();
+
+ /**
* Open a new window
*/
Window *windowOpen(Window *splitwin, glui32 method, glui32 size,