From 262337bc13cfa6725c8a5a7e3384fead5ded2d68 Mon Sep 17 00:00:00 2001 From: Benau Date: Sun, 7 Jan 2018 14:58:32 +0800 Subject: [PATCH] Fix some leaking when switching resolution --- src/graphics/irr_driver.cpp | 8 ++++---- src/graphics/sp/sp_base.cpp | 4 +++- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/src/graphics/irr_driver.cpp b/src/graphics/irr_driver.cpp index 97dafa814..46dea09f2 100644 --- a/src/graphics/irr_driver.cpp +++ b/src/graphics/irr_driver.cpp @@ -156,10 +156,6 @@ IrrDriver::~IrrDriver() #ifdef ENABLE_RECORDER ogrDestroy(); #endif - assert(m_device != NULL); - m_device->drop(); - m_device = NULL; - m_modes.clear(); STKTexManager::getInstance()->kill(); #ifndef SERVER_ONLY if (CVS->isGLSL()) @@ -169,6 +165,10 @@ IrrDriver::~IrrDriver() #endif delete m_wind; delete m_renderer; + assert(m_device != NULL); + m_device->drop(); + m_device = NULL; + m_modes.clear(); } // ~IrrDriver // ---------------------------------------------------------------------------- diff --git a/src/graphics/sp/sp_base.cpp b/src/graphics/sp/sp_base.cpp index 91ea1872e..25be99f77 100644 --- a/src/graphics/sp/sp_base.cpp +++ b/src/graphics/sp/sp_base.cpp @@ -969,12 +969,14 @@ void destroy() return; } - SPTextureManager::destroy(); + g_dy_dc.clear(); for (auto& p : g_shaders) { delete p.second; } g_shaders.clear(); + + SPTextureManager::destroy(); #ifndef SERVER_ONLY #ifndef USE_GLES2