diff --git a/jdk/src/macosx/native/sun/java2d/opengl/CGLGraphicsConfig.m b/jdk/src/macosx/native/sun/java2d/opengl/CGLGraphicsConfig.m index ba1f2bc59a1..bbe42519694 100644 --- a/jdk/src/macosx/native/sun/java2d/opengl/CGLGraphicsConfig.m +++ b/jdk/src/macosx/native/sun/java2d/opengl/CGLGraphicsConfig.m @@ -63,12 +63,14 @@ OGLGC_DestroyOGLGraphicsConfig(jlong pConfigInfo) CGLCtxInfo *ctxinfo = (CGLCtxInfo *)oglc->ctxInfo; if (ctxinfo != NULL) { + NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init]; [NSOpenGLContext clearCurrentContext]; [ctxinfo->context clearDrawable]; [ctxinfo->context release]; if (ctxinfo->scratchSurface != 0) { [ctxinfo->scratchSurface release]; } + [pool drain]; free(ctxinfo); } }