Fix some bugs

This commit is contained in:
Eduardo Bart
2012-07-30 05:51:03 -03:00
parent 1e2d20d289
commit 05436e135a
9 changed files with 34 additions and 11 deletions

View File

@@ -79,7 +79,6 @@ Texture::Texture(const ImagePtr& image, bool buildMipmaps)
Texture::~Texture()
{
assert(!g_app.isTerminated());
// free texture from gl memory
if(g_graphics.ok() && m_id != 0)
glDeleteTextures(1, &m_id);

View File

@@ -40,9 +40,12 @@ void TextureManager::terminate()
#ifndef NDEBUG
// check for leaks
int refs = 0;
for(const auto& it : m_textures)
if(it.second->ref_count() > 1)
for(const auto& it : m_textures) {
if(it.second->ref_count() > 1) {
refs++;
g_logger.debug(stdext::format("texture reference released: %s", it.first));
}
}
if(refs > 0)
g_logger.debug(stdext::format("%d textures references left", refs));
#endif