From 4457b343fe8eba3f2da096a72e38b1aac978ffd5 Mon Sep 17 00:00:00 2001
From: Sven Gothel <sgothel@jausoft.com>
Date: Mon, 18 Mar 2013 08:18:04 +0100
Subject: OSX CGL: Don't issue [NSOpenGLContext clearDrawable] for
 [NSOpenGLContext setView: view] which breaks pbuffer; Add [NSOpenGLContext
 clearDrawable].

---
 src/jogl/native/macosx/MacOSXWindowSystemInterface.m | 13 ++++++++++---
 1 file changed, 10 insertions(+), 3 deletions(-)

(limited to 'src/jogl/native')

diff --git a/src/jogl/native/macosx/MacOSXWindowSystemInterface.m b/src/jogl/native/macosx/MacOSXWindowSystemInterface.m
index 38f1789e3..d4d3ddad9 100644
--- a/src/jogl/native/macosx/MacOSXWindowSystemInterface.m
+++ b/src/jogl/native/macosx/MacOSXWindowSystemInterface.m
@@ -577,15 +577,22 @@ void setContextView(NSOpenGLContext* ctx, NSView* view) {
                 [ctx setView:view];
                 [view unlockFocus];        
             }
-        } else {
-            DBG_PRINT("setContextView.1: ctx %p, view nil: clearDrawable\n", ctx);
-            [ctx clearDrawable];
         }
         DBG_PRINT("setContextView.X\n");
     }
     [pool release];
 }
 
+void clearDrawable(NSOpenGLContext* ctx) {
+    NSAutoreleasePool* pool = [[NSAutoreleasePool alloc] init];
+    if ( nil != ctx ) {
+        DBG_PRINT("clearDrawable.0: %p\n", ctx);
+        [ctx clearDrawable];
+        DBG_PRINT("clearDrawable.X\n");
+    }
+    [pool release];
+}
+
 Bool makeCurrentContext(NSOpenGLContext* ctx) {
 #if 0
   // we issue the CGL Lock from Java upfront!
-- 
cgit v1.2.3