From 9c6a1ce0b669485967e7a81f0c96d122a9972957 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Wed, 20 May 2015 00:30:19 +0300 Subject: Fix memory leak in fast text draw code. --- src/gui/fonts/font.cpp | 2 ++ src/gui/gui.cpp | 7 ++++--- 2 files changed, 6 insertions(+), 3 deletions(-) (limited to 'src/gui') diff --git a/src/gui/fonts/font.cpp b/src/gui/fonts/font.cpp index 58528f383..6ba7a2ffb 100644 --- a/src/gui/fonts/font.cpp +++ b/src/gui/fonts/font.cpp @@ -392,6 +392,8 @@ void Font::generate(TextChunk &chunk) //search.erase(key); cache->remove(chunk2); chunk.img = chunk2->img; + chunk2->img = nullptr; + delete chunk2; // logger->log("cached image: " + chunk.text); } else diff --git a/src/gui/gui.cpp b/src/gui/gui.cpp index 39ab67be1..66d72af7b 100644 --- a/src/gui/gui.cpp +++ b/src/gui/gui.cpp @@ -265,15 +265,16 @@ Gui::~Gui() mMouseCursors = nullptr; } + if (windowContainer) + windowContainer->slowLogic(); + delete getTop(); + delete2(mGuiFont); delete2(boldFont); delete2(mHelpFont); delete2(mSecureFont); delete2(mInfoParticleFont); delete2(mNpcFont); - if (windowContainer) - windowContainer->slowLogic(); - delete getTop(); delete2(guiInput); -- cgit v1.2.3-70-g09d2