changeset 2416:d92493ff1b51 gsoc2008_iphone

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.
author Holmes Futrell <hfutrell@umail.ucsb.edu>
date Wed, 13 Aug 2008 20:56:21 +0000
parents 93fd226af6d0
children ac26bd83db1f
files src/video/uikit/SDL_uikitopengles.m
diffstat 1 files changed, 11 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/src/video/uikit/SDL_uikitopengles.m	Wed Aug 13 18:16:27 2008 +0000
+++ b/src/video/uikit/SDL_uikitopengles.m	Wed Aug 13 20:56:21 2008 +0000
@@ -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;
 }