From e15344bfaf4df4ceb710b304b164bd03005dc132 Mon Sep 17 00:00:00 2001 From: Sven Gothel Date: Sun, 12 Dec 2010 09:21:16 +0100 Subject: GLJPanel/GLPbufferImpl: destroy pbuffer reentrance fix; disable device close (X11 error on nvidia); reenable GLJPanel test --- .../com/jogamp/opengl/impl/GLDrawableHelper.java | 4 ++-- .../classes/com/jogamp/opengl/impl/GLPbufferImpl.java | 18 ++++++++++-------- 2 files changed, 12 insertions(+), 10 deletions(-) (limited to 'src/jogl/classes/com/jogamp/opengl/impl') diff --git a/src/jogl/classes/com/jogamp/opengl/impl/GLDrawableHelper.java b/src/jogl/classes/com/jogamp/opengl/impl/GLDrawableHelper.java index 45b04fac1..5dae257ed 100644 --- a/src/jogl/classes/com/jogamp/opengl/impl/GLDrawableHelper.java +++ b/src/jogl/classes/com/jogamp/opengl/impl/GLDrawableHelper.java @@ -314,7 +314,7 @@ public class GLDrawableHelper { Runnable initAction) { if(null==context) { if (DEBUG) { - Exception e = new GLException(Thread.currentThread().getName()+"Info: GLDrawableHelper " + this + ".invokeGL(): NULL GLContext"); + Exception e = new GLException(Thread.currentThread().getName()+" Info: GLDrawableHelper " + this + ".invokeGL(): NULL GLContext"); e.printStackTrace(); } return; @@ -323,7 +323,7 @@ public class GLDrawableHelper { if(null==initAction) { // disposal case if(!context.isCreated()) { - throw new GLException("Dispose case (no init action given): Native context must be created: "+context); + throw new GLException(Thread.currentThread().getName()+" GLDrawableHelper " + this + ".invokeGL(): Dispose case (no init action given): Native context is not created: "+context); } } diff --git a/src/jogl/classes/com/jogamp/opengl/impl/GLPbufferImpl.java b/src/jogl/classes/com/jogamp/opengl/impl/GLPbufferImpl.java index 558cda106..5119f5360 100644 --- a/src/jogl/classes/com/jogamp/opengl/impl/GLPbufferImpl.java +++ b/src/jogl/classes/com/jogamp/opengl/impl/GLPbufferImpl.java @@ -104,16 +104,18 @@ public class GLPbufferImpl implements GLPbuffer { DisposeAction disposeAction = new DisposeAction(); public void destroy() { - if (null != context) { - try { - drawableHelper.invokeGL(pbufferDrawable, context, disposeAction, null); - } catch (GLException gle) { - gle.printStackTrace(); + if(pbufferDrawable.isRealized()) { + if (null != context && context.isCreated()) { + try { + drawableHelper.invokeGL(pbufferDrawable, context, disposeAction, null); + } catch (GLException gle) { + gle.printStackTrace(); + } + context.destroy(); + // drawableHelper.reset(); } - drawableHelper.reset(); - context.destroy(); + pbufferDrawable.destroy(); } - pbufferDrawable.destroy(); } public void setSize(int width, int height) { -- cgit v1.2.3