GLK: Freeing of data on exit

This commit is contained in:
Paul Gilbert 2018-11-17 07:36:36 -08:00 committed by Paul Gilbert
parent 3d34cd151f
commit 4b011b2f1c
4 changed files with 28 additions and 2 deletions

View File

@ -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;

View File

@ -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;
@ -74,6 +79,11 @@ public:
*/
WindowMask();
/**
* Destructor
*/
~WindowMask();
/**
* Resize the links array
*/

View File

@ -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;

View File

@ -151,6 +151,11 @@ public:
*/
Windows(Graphics::Screen *screen);
/**
* Destructor
*/
~Windows();
/**
* Open a new window
*/