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

@@ -23,7 +23,9 @@
#include "framebuffer.h"
#include "graphics.h"
#include "texture.h"
#include <framework/platform/platformwindow.h>
#include <framework/application.h>
uint FrameBuffer::boundFbo = 0;
@@ -32,12 +34,6 @@ FrameBuffer::FrameBuffer()
internalCreate();
}
FrameBuffer::FrameBuffer(const Size& size)
{
internalCreate();
resize(size);
}
void FrameBuffer::internalCreate()
{
m_prevBoundFbo = 0;
@@ -51,14 +47,14 @@ void FrameBuffer::internalCreate()
FrameBuffer::~FrameBuffer()
{
if(m_fbo != 0)
assert(!g_app->isTermianted());
if(g_graphics.ok() && m_fbo != 0)
glDeleteFramebuffers(1, &m_fbo);
}
void FrameBuffer::resize(const Size& size)
{
if(!size.isValid())
return;
assert(size.isValid());
if(m_texture && m_texture->getSize() == size)
return;