From 46041e0cc0d2467d470b444cb50cd9b6ae1fa695 Mon Sep 17 00:00:00 2001 From: Yan Date: Fri, 5 Jul 2024 01:38:41 +0200 Subject: [PATCH] Always initialize display->gl_context on macOS Otherwise SDL_GL_DeleteContext() tried to access an uninitialized pointer upon exit when not using the OpenGL renderer. SDL_GL_DeleteContext() doesn't try to delete a NULL pointer, so no need to check for that. Fixes #5057 PR #5058 Signed-off-by: Romain Vimont --- app/src/display.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/app/src/display.c b/app/src/display.c index 9f5fb0c6..39018834 100644 --- a/app/src/display.c +++ b/app/src/display.c @@ -43,6 +43,10 @@ sc_display_init(struct sc_display *display, SDL_Window *window, display->mipmaps = false; +#ifdef SC_DISPLAY_FORCE_OPENGL_CORE_PROFILE + display->gl_context = NULL; +#endif + // starts with "opengl" bool use_opengl = renderer_name && !strncmp(renderer_name, "opengl", 6); if (use_opengl) {