Fix hash map collisions when setting canvases.

This commit is contained in:
Alex Szpakowski
2018-04-02 15:58:38 -03:00
parent 43263c1469
commit cfa30167ca
5 changed files with 114 additions and 48 deletions
+7
View File
@@ -20,6 +20,7 @@
#include "Canvas.h"
#include "graphics/Graphics.h"
#include "Graphics.h"
#include <algorithm> // For min/max
@@ -270,6 +271,12 @@ 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)
gl.deleteFramebuffer(fbo);