From 02773811b35f8cd86b5bb7d48c3321585d7bb293 Mon Sep 17 00:00:00 2001 From: "Ryan C. Gordon" Date: Thu, 18 May 2017 21:00:11 -0400 Subject: [PATCH] render: GL_DestroyRender() should activate first. Otherwise, we might destroy a different GL context's resources. --- src/render/opengl/SDL_render_gl.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/render/opengl/SDL_render_gl.c b/src/render/opengl/SDL_render_gl.c index 449335956..9ad2eb720 100644 --- a/src/render/opengl/SDL_render_gl.c +++ b/src/render/opengl/SDL_render_gl.c @@ -1523,6 +1523,11 @@ GL_DestroyRenderer(SDL_Renderer * renderer) GL_RenderData *data = (GL_RenderData *) renderer->driverdata; if (data) { + if (data->context != NULL) { + /* make sure we delete the right resources! */ + GL_ActivateRenderer(renderer); + } + GL_ClearErrors(renderer); if (data->GL_ARB_debug_output_supported) { PFNGLDEBUGMESSAGECALLBACKARBPROC glDebugMessageCallbackARBFunc = (PFNGLDEBUGMESSAGECALLBACKARBPROC) SDL_GL_GetProcAddress("glDebugMessageCallbackARB");