mirror of
https://github.com/edubart/otclient.git
synced 2025-10-22 15:25:54 +02:00
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:
@@ -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;
|
||||
|
Reference in New Issue
Block a user