From 56549f68d4770908889c10ecce3ac74f80d99fe1 Mon Sep 17 00:00:00 2001 From: Benau Date: Sat, 30 Apr 2016 07:00:24 +0800 Subject: [PATCH] Fix memory leak --- src/graphics/material_manager.cpp | 7 +++++++ src/guiengine/engine.cpp | 4 ++-- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/src/graphics/material_manager.cpp b/src/graphics/material_manager.cpp index ce1984f5c..7c227b7e5 100644 --- a/src/graphics/material_manager.cpp +++ b/src/graphics/material_manager.cpp @@ -60,6 +60,13 @@ MaterialManager::~MaterialManager() delete m_materials[i]; } m_materials.clear(); + + for (std::map ::iterator it = + m_default_materials.begin(); it != m_default_materials.end(); it++) + { + delete it->second; + } + m_default_materials.clear(); } // ~MaterialManager //----------------------------------------------------------------------------- diff --git a/src/guiengine/engine.cpp b/src/guiengine/engine.cpp index bcf3fd5e8..831ebfdb2 100644 --- a/src/guiengine/engine.cpp +++ b/src/guiengine/engine.cpp @@ -954,9 +954,9 @@ namespace GUIEngine //if (g_skin != NULL) delete g_skin; g_skin = NULL; - g_ft_env->~FTEnvironment(); + delete g_ft_env; g_ft_env = NULL; - g_gp_creator->~GlyphPageCreator(); + delete g_gp_creator; g_gp_creator = NULL; for (unsigned int i=0; i