Fixes #2296 - SDL_GL_UnbindTexture segfaults (thanks Daniel Bünzli)
authorGabriel Jacobo <gabomdq@gmail.com>
Mon, 24 Feb 2014 18:57:22 -0300
changeset 8249 294f28074ecc
parent 8248 427d0a6f5af7
child 8250 e671ec6b22dd
Fixes #2296 - SDL_GL_UnbindTexture segfaults (thanks Daniel Bünzli)
src/render/SDL_render.c
--- a/src/render/SDL_render.c	Mon Feb 24 11:24:48 2014 -0500
+++ b/src/render/SDL_render.c	Mon Feb 24 18:57:22 2014 -0300
@@ -1876,7 +1876,9 @@
 
     CHECK_TEXTURE_MAGIC(texture, -1);
     renderer = texture->renderer;
-    if (renderer && renderer->GL_UnbindTexture) {
+    if (texture->native) {
+        return SDL_GL_UnbindTexture(texture->native);
+    } else if (renderer && renderer->GL_UnbindTexture) {
         return renderer->GL_UnbindTexture(renderer, texture);
     }