From c985b1f2f75f382f3e4a454baf127c7482e0d3e5 Mon Sep 17 00:00:00 2001 From: Alex Szpakowski Date: Mon, 31 Mar 2014 05:01:29 -0300 Subject: [PATCH] Don't destroy OpenGL resources before checking whether the fullscreen size is supported in love.window.setMode. --- src/modules/window/sdl/Window.cpp | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/modules/window/sdl/Window.cpp b/src/modules/window/sdl/Window.cpp index 6854e11f9..7ea6044e8 100644 --- a/src/modules/window/sdl/Window.cpp +++ b/src/modules/window/sdl/Window.cpp @@ -70,10 +70,6 @@ Window::_currentMode::_currentMode() bool Window::setWindow(int width, int height, WindowSettings *settings) { - graphics::Graphics *gfx = (graphics::Graphics *) Module::findInstance("love.graphics."); - if (gfx != nullptr) - gfx->unSetMode(); - WindowSettings f; if (settings) @@ -122,6 +118,10 @@ bool Window::setWindow(int width, int height, WindowSettings *settings) sdlflags |= SDL_WINDOW_ALLOW_HIGHDPI; #endif + graphics::Graphics *gfx = (graphics::Graphics *) Module::findInstance("love.graphics."); + if (gfx != nullptr) + gfx->unSetMode(); + // Destroy and recreate the window if the dimensions or flags have changed. if (window) { @@ -155,6 +155,8 @@ bool Window::setWindow(int width, int height, WindowSettings *settings) if (!window) { + created = false; + // In Windows and Linux, some GL attributes are set on window creation. setWindowGLAttributes(f.fsaa, f.sRGB);