diff options
author | Filippos Karapetis | 2009-10-07 17:29:37 +0000 |
---|---|---|
committer | Filippos Karapetis | 2009-10-07 17:29:37 +0000 |
commit | 6e17b025a5aace9de4d189e6c7545eb0edef4f63 (patch) | |
tree | b9bbb6e3ae8e6f27b0c7f3c1ebbe517a70ef4cfb /engines/sci | |
parent | 94a9616d909850703b7c9c9f736bdc82d5494b7f (diff) | |
download | scummvm-rg350-6e17b025a5aace9de4d189e6c7545eb0edef4f63.tar.gz scummvm-rg350-6e17b025a5aace9de4d189e6c7545eb0edef4f63.tar.bz2 scummvm-rg350-6e17b025a5aace9de4d189e6c7545eb0edef4f63.zip |
Implemented the SciGuiView destructor and plugged a memory leak in the current GUI
svn-id: r44740
Diffstat (limited to 'engines/sci')
-rw-r--r-- | engines/sci/gfx/gfx_resmgr.cpp | 3 | ||||
-rw-r--r-- | engines/sci/gui/gui_view.cpp | 9 |
2 files changed, 11 insertions, 1 deletions
diff --git a/engines/sci/gfx/gfx_resmgr.cpp b/engines/sci/gfx/gfx_resmgr.cpp index b3d31ac1c9..6e4fac544e 100644 --- a/engines/sci/gfx/gfx_resmgr.cpp +++ b/engines/sci/gfx/gfx_resmgr.cpp @@ -554,7 +554,6 @@ gfxr_view_t *GfxResManager::getView(int nr, int *loop, int *cel, int palette) { curCel->index_data = (byte *)malloc(celInfo->width * celInfo->height); byte *tmpBuffer = guiView->getBitmap(i, j); memcpy(curCel->index_data, tmpBuffer, celInfo->width * celInfo->height); - delete tmpBuffer; curCel->flags = 0; curCel->width = celInfo->width; curCel->height = celInfo->height; @@ -569,6 +568,8 @@ gfxr_view_t *GfxResManager::getView(int nr, int *loop, int *cel, int palette) { } } + delete guiView; + if (!res) { res = (gfx_resource_t *)malloc(sizeof(gfx_resource_t)); res->scaled_data.view = NULL; diff --git a/engines/sci/gui/gui_view.cpp b/engines/sci/gui/gui_view.cpp index 1c3072eaed..83f63fb8a8 100644 --- a/engines/sci/gui/gui_view.cpp +++ b/engines/sci/gui/gui_view.cpp @@ -40,6 +40,15 @@ SciGuiView::SciGuiView(ResourceManager *resMan, SciGuiScreen *screen, SciGuiPale } SciGuiView::~SciGuiView() { + // Iterate through the loops + for (uint16 loopNum = 0; loopNum < _loopCount; loopNum++) { + // and through the cells of each loop + for (uint16 celNum = 0; celNum < _loop[loopNum].celCount; celNum++) { + delete _loop[loopNum].cel[celNum].rawBitmap; + } + delete _loop[loopNum].cel; + } + delete _loop; } static const byte EGAMappingDefault[] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15 }; |