changeset 29575:0e182921966b

Make glContext a local variable, it is not needed outside the function where it is allocated, reference counting takes care of freeing it.
author reimar
date Tue, 01 Sep 2009 21:16:58 +0000
parents 0aa36133f638
children fbed30114410
files libvo/vo_corevideo.h libvo/vo_corevideo.m
diffstat 2 files changed, 2 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/libvo/vo_corevideo.h	Tue Sep 01 21:12:33 2009 +0000
+++ b/libvo/vo_corevideo.h	Tue Sep 01 21:16:58 2009 +0000
@@ -40,7 +40,6 @@
 {
 	//Cocoa
 	NSWindow *window;
-	NSOpenGLContext *glContext;
 	NSEvent *event;
 
 	//CoreVideo
--- a/libvo/vo_corevideo.m	Tue Sep 01 21:12:33 2009 +0000
+++ b/libvo/vo_corevideo.m	Tue Sep 01 21:16:58 2009 +0000
@@ -436,6 +436,7 @@
 @implementation MPlayerOpenGLView
 - (void) preinit
 {
+	NSOpenGLContext *glContext;
 	GLint swapInterval = 1;
 	CVReturn error;
 
@@ -464,6 +465,7 @@
 	[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 @@
 	CVOpenGLTextureCacheRelease(textureCache);
 	textureCache = NULL;
 	[self setOpenGLContext:nil];
-	[glContext release];
-	glContext = NULL;
 	[super dealloc];
 }