Fix love.event.quit causing crashes and other bad behaviour if a Canvas is active. Resolves issue #1395.

This commit is contained in:
Alex Szpakowski
2018-04-07 12:43:00 -03:00
parent 7b91ab915c
commit bb228cab0c
3 changed files with 20 additions and 10 deletions
+8 -5
View File
@@ -271,11 +271,14 @@ bool Canvas::loadVolatile()
void Canvas::unloadVolatile()
{
// This is a bit ugly, but we need some way to destroy the cached FBO
// when this Canvas' texture is destroyed.
auto gfx = Module::getInstance<Graphics>(Module::M_GRAPHICS);
if (gfx != nullptr)
gfx->cleanupCanvas(this);
if (fbo != 0 || renderbuffer != 0 || texture != 0)
{
// This is a bit ugly, but we need some way to destroy the cached FBO
// when this Canvas' texture is destroyed.
auto gfx = Module::getInstance<Graphics>(Module::M_GRAPHICS);
if (gfx != nullptr)
gfx->cleanupCanvas(this);
}
if (fbo != 0)
gl.deleteFramebuffer(fbo);