From be8c19911f96be997b6beb670a3364fcaa737b06 Mon Sep 17 00:00:00 2001 From: Alex Szpakowski Date: Mon, 31 Mar 2014 04:56:29 -0300 Subject: [PATCH] Fixed love.graphics.isCreated to properly return false if love.window.setMode failed --- src/modules/graphics/opengl/Graphics.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/modules/graphics/opengl/Graphics.cpp b/src/modules/graphics/opengl/Graphics.cpp index 80a0c3026..68b71f379 100644 --- a/src/modules/graphics/opengl/Graphics.cpp +++ b/src/modules/graphics/opengl/Graphics.cpp @@ -246,15 +246,19 @@ bool Graphics::setMode(int width, int height, bool &sRGB) void Graphics::unSetMode() { + if (!isCreated()) + return; + // Window re-creation may destroy the GL context, so we must save the state. - if (isCreated()) - savedState = saveState(); + savedState = saveState(); // Unload all volatile objects. These must be reloaded after the display // mode change. Volatile::unloadAll(); gl.deInitContext(); + + created = false; } static void APIENTRY debugCB(GLenum source, GLenum type, GLuint id, GLenum severity, GLsizei /*len*/, const GLchar *msg, GLvoid* /*usr*/)