From 8daef597ec26d2bc14e25e3af7ce2ca9b068a932 Mon Sep 17 00:00:00 2001 From: Holmes Futrell Date: Wed, 13 Aug 2008 20:56:21 +0000 Subject: [PATCH] Fixed a bug where bad access would occur if UIKIT_MakeCurrent is passed NULL for the parameter 'SDL_GLContext context'. Instead, it clears the current context. --- src/video/uikit/SDL_uikitopengles.m | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/src/video/uikit/SDL_uikitopengles.m b/src/video/uikit/SDL_uikitopengles.m index 7ac7d9f5f..52ab310c8 100644 --- a/src/video/uikit/SDL_uikitopengles.m +++ b/src/video/uikit/SDL_uikitopengles.m @@ -41,12 +41,20 @@ return SDL_LoadFunction(RTLD_DEFAULT, proc); } +/* + note that SDL_GL_Delete context makes it current without passing the window +*/ int UIKit_GL_MakeCurrent(_THIS, SDL_Window * window, SDL_GLContext context) { - SDL_WindowData *data = (SDL_WindowData *)window->driverdata; - - [data->view setCurrentContext]; + if (context) { + SDL_WindowData *data = (SDL_WindowData *)window->driverdata; + [data->view setCurrentContext]; + } + else { + [EAGLContext setCurrentContext: nil]; + } + return 0; }