From d8511956f51c32cd04090d6157d3347675225050 Mon Sep 17 00:00:00 2001 From: Benau Date: Tue, 23 Jan 2018 16:18:48 +0800 Subject: [PATCH] Only warn for possible undeleted opengl stuff when debug build Happens when you press close button in stk window. --- src/graphics/shader_files_manager.hpp | 9 ++++++++- src/graphics/sp/sp_shader_manager.cpp | 2 ++ src/graphics/sp/sp_texture_manager.cpp | 2 ++ 3 files changed, 12 insertions(+), 1 deletion(-) diff --git a/src/graphics/shader_files_manager.hpp b/src/graphics/shader_files_manager.hpp index 449686a6f..93c522dfb 100644 --- a/src/graphics/shader_files_manager.hpp +++ b/src/graphics/shader_files_manager.hpp @@ -21,6 +21,7 @@ #define HEADER_SHADER_FILES_MANAGER_HPP #include "graphics/gl_headers.hpp" +#include "utils/log.hpp" #include "utils/no_copy.hpp" #include "utils/singleton.hpp" @@ -60,7 +61,13 @@ public: void removeAllShaderFiles() { removeUnusedShaderFiles(); - assert(m_shader_files_loaded.empty()); + if (!m_shader_files_loaded.empty()) + { +#ifdef DEBUG + Log::error("ShaderFilesManager", "Some shader file > 1 ref_count"); +#endif + m_shader_files_loaded.clear(); + } } // ------------------------------------------------------------------------ void removeUnusedShaderFiles() diff --git a/src/graphics/sp/sp_shader_manager.cpp b/src/graphics/sp/sp_shader_manager.cpp index 0ff6b9e53..631faf42a 100644 --- a/src/graphics/sp/sp_shader_manager.cpp +++ b/src/graphics/sp/sp_shader_manager.cpp @@ -139,10 +139,12 @@ SPShaderManager::~SPShaderManager() { m_official_shaders.clear(); removeUnusedShaders(); +#ifdef DEBUG for (auto p : m_shaders) { Log::error("SPShaderManager", "%s > 1 ref_count", p.first.c_str()); } +#endif } // ~SPShaderManager // ---------------------------------------------------------------------------- diff --git a/src/graphics/sp/sp_texture_manager.cpp b/src/graphics/sp/sp_texture_manager.cpp index 75f3b7dd1..fbd955fa3 100644 --- a/src/graphics/sp/sp_texture_manager.cpp +++ b/src/graphics/sp/sp_texture_manager.cpp @@ -89,10 +89,12 @@ SPTextureManager::~SPTextureManager() } m_threaded_load_obj.clear(); removeUnusedTextures(); +#ifdef DEBUG for (auto p : m_textures) { Log::error("SPTextureManager", "%s > 1 ref_count", p.first.c_str()); } +#endif } // ~SPTextureManager // ----------------------------------------------------------------------------