From dce1d4aa4b319a934e94e45c3a264c75207a6577 Mon Sep 17 00:00:00 2001 From: Johannes Schickel Date: Wed, 9 Dec 2009 23:05:15 +0000 Subject: [PATCH] Properly clean up memory when destroying CursorManager. svn-id: r46325 --- graphics/cursorman.cpp | 9 +++++++++ graphics/cursorman.h | 1 + 2 files changed, 10 insertions(+) diff --git a/graphics/cursorman.cpp b/graphics/cursorman.cpp index c14dc0744f3..f056cf86d45 100644 --- a/graphics/cursorman.cpp +++ b/graphics/cursorman.cpp @@ -31,6 +31,15 @@ DECLARE_SINGLETON(Graphics::CursorManager); namespace Graphics { +CursorManager::~CursorManager() { + for (int i = 0; i < _cursorStack.size(); ++i) + delete _cursorStack[i]; + _cursorStack.clear(); + for (int i = 0; i < _cursorPaletteStack.size(); ++i) + delete _cursorPaletteStack[i]; + _cursorPaletteStack.clear(); +} + bool CursorManager::isVisible() { if (_cursorStack.empty()) return false; diff --git a/graphics/cursorman.h b/graphics/cursorman.h index 1a5c116232a..3536f27f9e7 100644 --- a/graphics/cursorman.h +++ b/graphics/cursorman.h @@ -165,6 +165,7 @@ private: // ourselves, so it is private and thus there is no way to create this class // except from the Singleton code. CursorManager() {} + ~CursorManager(); struct Cursor { byte *_data;