Fix memory leaks

* Fix recursive reference memory leak in UIWidget
* Make Event/ScheduledEvent memory-leak safe
* Fix exit crashs by freeing graphics resources before destroying GL context
* Add many asserts to avoid any leak regression
This commit is contained in:
Eduardo Bart
2012-06-18 05:13:52 -03:00
parent f650b0e5bb
commit 1c7bbaea89
42 changed files with 326 additions and 81 deletions

View File

@@ -33,6 +33,8 @@
#include <framework/graphics/graphics.h>
#include <framework/graphics/texture.h>
#include "texturemanager.h"
#include "framebuffermanager.h"
#include <framework/platform/platformwindow.h>
Graphics g_graphics;
@@ -88,13 +90,19 @@ void Graphics::init()
m_alphaBits = 0;
glGetIntegerv(GL_ALPHA_BITS, &m_alphaBits);
m_ok = true;
selectPainterEngine(m_prefferedPainterEngine);
m_emptyTexture = TexturePtr(new Texture);
g_textures.init();
g_framebuffers.init();
}
void Graphics::terminate()
{
g_fonts.releaseFonts();
g_fonts.terminate();
g_framebuffers.terminate();
g_textures.terminate();
#ifdef PAINTER_OGL2
if(g_painterOGL2) {
@@ -112,7 +120,7 @@ void Graphics::terminate()
g_painter = nullptr;
m_emptyTexture.reset();
m_ok = false;
}
bool Graphics::parseOption(const std::string& option)