From 751c03d4a83f4e7a84314d5f72ef3b7cdf5d6e33 Mon Sep 17 00:00:00 2001 From: Alug Date: Fri, 14 Nov 2025 12:35:35 +0100 Subject: [PATCH] fail loudly if sdl window/renderer/gl context creation fails this will crash eitherways, so much rather get atleast a somewhat more informative error --- src/sdl/i_video.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/src/sdl/i_video.c b/src/sdl/i_video.c index b59ac8d59..77babb41c 100644 --- a/src/sdl/i_video.c +++ b/src/sdl/i_video.c @@ -1814,7 +1814,11 @@ static SDL_bool Impl_CreateContext(void) I_Error("Failed to create a GL context: %s\n", SDL_GetError()); } - SDL_GL_MakeCurrent(window, sdlglcontext); + if (SDL_GL_MakeCurrent(window, sdlglcontext) < 0) + { + SDL_DestroyWindow(window); + I_Error("Failed to set up GL context: %s\n", SDL_GetError()); + } // be sure to fill the resolution list the moment we have a window I_FillScreenResolutionsList(false); @@ -1855,8 +1859,7 @@ static SDL_bool Impl_CreateContext(void) if (renderer == NULL) { - CONS_Printf(M_GetText("Couldn't create rendering context: %s\n"), SDL_GetError()); - return SDL_FALSE; + I_Error("Couldn't create rendering context: %s\n", SDL_GetError()); } SDL_RenderSetLogicalSize(renderer, BASEVIDWIDTH, BASEVIDHEIGHT); @@ -1912,8 +1915,7 @@ static SDL_bool Impl_CreateWindow(SDL_bool fullscreen) if (window == NULL) { - CONS_Printf(M_GetText("Couldn't create window: %s\n"), SDL_GetError()); - return SDL_FALSE; + I_Error("Couldn't create window: %s\n", SDL_GetError()); } return Impl_CreateContext();