From 27a1382c0e2ad4776965616cbfd934fb1129bd1c Mon Sep 17 00:00:00 2001 From: "Ryan C. Gordon" Date: Thu, 13 Oct 2005 09:47:06 +0000 Subject: [PATCH] Closed a memory leak caused when quitting video subsystem on Quartz target. --- src/video/quartz/SDL_QuartzGL.m | 4 ++-- src/video/quartz/SDL_QuartzVideo.m | 3 ++- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/src/video/quartz/SDL_QuartzGL.m b/src/video/quartz/SDL_QuartzGL.m index fb1fe921a..bc3443b63 100644 --- a/src/video/quartz/SDL_QuartzGL.m +++ b/src/video/quartz/SDL_QuartzGL.m @@ -119,6 +119,8 @@ int QZ_SetupOpenGL (_THIS, int bpp, Uint32 flags) { gl_context = [ [ NSOpenGLContext alloc ] initWithFormat:fmt shareContext:nil]; + [ fmt release ]; + if (gl_context == nil) { SDL_SetError ("Failed creating OpenGL context"); return 0; @@ -152,8 +154,6 @@ int QZ_SetupOpenGL (_THIS, int bpp, Uint32 flags) { /* Convince SDL that the GL "driver" is loaded */ this->gl_config.driver_loaded = 1; - [ fmt release ]; - return 1; } diff --git a/src/video/quartz/SDL_QuartzVideo.m b/src/video/quartz/SDL_QuartzVideo.m index 6c369bc2e..9304b6cd6 100644 --- a/src/video/quartz/SDL_QuartzVideo.m +++ b/src/video/quartz/SDL_QuartzVideo.m @@ -487,9 +487,10 @@ static void QZ_UnsetVideoMode (_THIS) { else { [ qz_window close ]; + [ qz_window release ]; qz_window = nil; window_view = nil; - + /* Release the OpenGL context */ if ( mode_flags & SDL_OPENGL ) QZ_TearDownOpenGL (this);