Use SDL_GL_DeleteContext instead of Cocoa_GL_DeleteContext for context cleanup That will make the current context NULL before deleting the context.