aboutsummaryrefslogtreecommitdiff
path: root/engines
diff options
context:
space:
mode:
authorPaul Gilbert2018-11-17 07:36:36 -0800
committerPaul Gilbert2018-12-08 19:05:59 -0800
commit4b011b2f1cfdc3aac0468248f4feb9faea3501a2 (patch)
tree1c252f542408f34b159e77622b5f70d43947b5d6 /engines
parent3d34cd151f9f56d24299eba4372e71e4a6b26131 (diff)
downloadscummvm-rg350-4b011b2f1cfdc3aac0468248f4feb9faea3501a2.tar.gz
scummvm-rg350-4b011b2f1cfdc3aac0468248f4feb9faea3501a2.tar.bz2
scummvm-rg350-4b011b2f1cfdc3aac0468248f4feb9faea3501a2.zip
GLK: Freeing of data on exit
Diffstat (limited to 'engines')
-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,