From 1b3c42472d2e088a134c1f020b2ae4de3fb3a159 Mon Sep 17 00:00:00 2001 From: reimar Date: Tue, 1 Sep 2009 21:16:58 +0000 Subject: [PATCH] Make glContext a local variable, it is not needed outside the function where it is allocated, reference counting takes care of freeing it. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@29617 b3059339-0415-0410-9bf9-f77b7e298cf2 --- libvo/vo_corevideo.h | 1 - libvo/vo_corevideo.m | 4 ++-- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/libvo/vo_corevideo.h b/libvo/vo_corevideo.h index 7789aa87af..691ebe6537 100644 --- a/libvo/vo_corevideo.h +++ b/libvo/vo_corevideo.h @@ -40,7 +40,6 @@ { //Cocoa NSWindow *window; - NSOpenGLContext *glContext; NSEvent *event; //CoreVideo diff --git a/libvo/vo_corevideo.m b/libvo/vo_corevideo.m index e299a09137..099963c167 100644 --- a/libvo/vo_corevideo.m +++ b/libvo/vo_corevideo.m @@ -436,6 +436,7 @@ static int control(uint32_t request, void *data, ...) @implementation MPlayerOpenGLView - (void) preinit { + NSOpenGLContext *glContext; GLint swapInterval = 1; CVReturn error; @@ -464,6 +465,7 @@ static int control(uint32_t request, void *data, ...) [glContext setValues:&swapInterval forParameter:NSOpenGLCPSwapInterval]; [glContext setView:self]; [glContext makeCurrentContext]; + [glContext release]; error = CVOpenGLTextureCacheCreate(NULL, 0, [glContext CGLContextObj], [[self pixelFormat] CGLPixelFormatObj], 0, &textureCache); if(error != kCVReturnSuccess) @@ -486,8 +488,6 @@ static int control(uint32_t request, void *data, ...) CVOpenGLTextureCacheRelease(textureCache); textureCache = NULL; [self setOpenGLContext:nil]; - [glContext release]; - glContext = NULL; [super dealloc]; }