Skip to content

Commit

Permalink
Always initialize display->gl_context on macOS
Browse files Browse the repository at this point in the history
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 Genymobile#5057 <Genymobile#5057>
PR Genymobile#5058 <Genymobile#5058>

Signed-off-by: Romain Vimont <[email protected]>
  • Loading branch information
Yan authored and Gottox committed Sep 29, 2024
1 parent c87594e commit 40afff4
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions app/src/display.c
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down

0 comments on commit 40afff4

Please sign in to comment.