From 0120a81c36ffc7455d196960048fe935f82fc9a6 Mon Sep 17 00:00:00 2001 From: Sven Gothel Date: Thu, 10 Nov 2011 17:14:51 +0100 Subject: OS X Layered View: Part6 (native) Using a root CALayer where we attach/detach our GL one - it seems to be more stable, having one root CALayer attached to the JAWT_SurfaceView forever - tackles crach at GL layer destruction - proper release of all GL layer resources - now final [gl-layer dealloc] happens at very destruction of JAWT object, even though it was removed from root-layer earlier (and all other references) - see comment in MacOSXWindowSystemInterface-pbuffer.m :: createNSOpenGLLayer(..) - at least no more crash .. and resource release ASAP, but the GL-layer itself (see above) --- src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXCGLContext.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src/jogl/classes/jogamp/opengl') diff --git a/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXCGLContext.java b/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXCGLContext.java index 8e845e847..b75d2f927 100644 --- a/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXCGLContext.java +++ b/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXCGLContext.java @@ -477,11 +477,11 @@ public abstract class MacOSXCGLContext extends GLContextImpl } else { texWidth = drawable.getWidth(); texHeight = drawable.getHeight(); - } + } nsOpenGLLayer = CGL.createNSOpenGLLayer(ctx, nsOpenGLLayerPFmt, drawable.getHandle(), fixedCaps.isBackgroundOpaque(), texWidth, texHeight); if (DEBUG) { System.err.println("NS create nsOpenGLLayer "+toHexString(nsOpenGLLayer)); - } + } lsh.attachSurfaceLayer(nsOpenGLLayer); } } finally { @@ -499,8 +499,8 @@ public abstract class MacOSXCGLContext extends GLContextImpl if (DEBUG) { System.err.println("NS destroy nsOpenGLLayer "+toHexString(nsOpenGLLayer)); } - lsh.attachSurfaceLayer(0); CGL.releaseNSOpenGLLayer(nsOpenGLLayer); + lsh.detachSurfaceLayer(nsOpenGLLayer); CGL.deletePixelFormat(nsOpenGLLayerPFmt); nsOpenGLLayerPFmt = 0; nsOpenGLLayer = 0; -- cgit v1.2.3