From cc0cdbbd22584ff38562c1a691de6aa8d27b34c3 Mon Sep 17 00:00:00 2001 From: Eugene Sandulenko Date: Fri, 30 Apr 2021 14:01:17 +0200 Subject: [PATCH] GRAPHICS: MACGUI: Plug memory leak --- graphics/macgui/datafiles.cpp | 4 ++++ graphics/macgui/macwindowmanager.cpp | 2 ++ graphics/macgui/macwindowmanager.h | 1 + 3 files changed, 7 insertions(+) diff --git a/graphics/macgui/datafiles.cpp b/graphics/macgui/datafiles.cpp index 2add870a47c..2cbcc0a7069 100644 --- a/graphics/macgui/datafiles.cpp +++ b/graphics/macgui/datafiles.cpp @@ -82,6 +82,10 @@ void MacWindowManager::loadDataBundle() { } } +void MacWindowManager::cleanupDataBundle() { + delete _dataBundle; +} + BorderOffsets MacWindowManager::getBorderOffsets(byte windowType) { int i = 0; while (borders[i].type != 0xFF) { diff --git a/graphics/macgui/macwindowmanager.cpp b/graphics/macgui/macwindowmanager.cpp index d6566d0970f..cd710838fb6 100644 --- a/graphics/macgui/macwindowmanager.cpp +++ b/graphics/macgui/macwindowmanager.cpp @@ -236,6 +236,8 @@ MacWindowManager::~MacWindowManager() { delete _desktopBmp; delete _desktop; + cleanupDataBundle(); + g_system->getTimerManager()->removeTimerProc(&menuTimerHandler); } diff --git a/graphics/macgui/macwindowmanager.h b/graphics/macgui/macwindowmanager.h index acc23a802d0..0ed4786b459 100644 --- a/graphics/macgui/macwindowmanager.h +++ b/graphics/macgui/macwindowmanager.h @@ -306,6 +306,7 @@ public: void removeMarked(); void loadDataBundle(); + void cleanupDataBundle(); BorderOffsets getBorderOffsets(byte windowType); Common::SeekableReadStream *getBorderFile(byte windowType, uint32 flags); Common::SeekableReadStream *getFile(const Common::String &filename);