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. gsoc2008_iphone
authorHolmes Futrell <hfutrell@umail.ucsb.edu>
Wed, 13 Aug 2008 20:56:21 +0000
branchgsoc2008_iphone
changeset 2416d92493ff1b51
parent 2415 93fd226af6d0
child 2417 ac26bd83db1f
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
     1.1 --- a/src/video/uikit/SDL_uikitopengles.m	Wed Aug 13 18:16:27 2008 +0000
     1.2 +++ b/src/video/uikit/SDL_uikitopengles.m	Wed Aug 13 20:56:21 2008 +0000
     1.3 @@ -41,12 +41,20 @@
     1.4      return SDL_LoadFunction(RTLD_DEFAULT, proc);
     1.5  }
     1.6  
     1.7 +/*
     1.8 +	note that SDL_GL_Delete context makes it current without passing the window
     1.9 +*/
    1.10  int UIKit_GL_MakeCurrent(_THIS, SDL_Window * window, SDL_GLContext context)
    1.11  {
    1.12  	
    1.13 -	SDL_WindowData *data = (SDL_WindowData *)window->driverdata;
    1.14 -	
    1.15 -	[data->view setCurrentContext];
    1.16 +	if (context) {
    1.17 +		SDL_WindowData *data = (SDL_WindowData *)window->driverdata;
    1.18 +		[data->view setCurrentContext];
    1.19 +	}
    1.20 +	else {
    1.21 +		[EAGLContext setCurrentContext: nil];
    1.22 +	}
    1.23 +		
    1.24      return 0;
    1.25  }
    1.26