summaryrefslogtreecommitdiffstats
path: root/src/classes/com/sun/opengl/impl/GLPbufferImpl.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/classes/com/sun/opengl/impl/GLPbufferImpl.java')
-rw-r--r--src/classes/com/sun/opengl/impl/GLPbufferImpl.java20
1 files changed, 18 insertions, 2 deletions
diff --git a/src/classes/com/sun/opengl/impl/GLPbufferImpl.java b/src/classes/com/sun/opengl/impl/GLPbufferImpl.java
index 196ea7223..feb9d3512 100644
--- a/src/classes/com/sun/opengl/impl/GLPbufferImpl.java
+++ b/src/classes/com/sun/opengl/impl/GLPbufferImpl.java
@@ -172,8 +172,12 @@ public class GLPbufferImpl implements GLPbuffer {
PropertyChangeListener listener) {}
public void destroy() {
- context.destroy();
- pbufferDrawable.destroy();
+ if (Threading.isSingleThreaded() &&
+ !Threading.isOpenGLThread()) {
+ Threading.invokeOnOpenGLThread(destroyAction);
+ } else {
+ destroyAction.run();
+ }
}
public int getFloatingPointMode() {
@@ -238,4 +242,16 @@ public class GLPbufferImpl implements GLPbuffer {
}
private SwapBuffersOnEventDispatchThreadAction swapBuffersOnEventDispatchThreadAction =
new SwapBuffersOnEventDispatchThreadAction();
+
+ class DestroyAction implements Runnable {
+ public void run() {
+ GLContext current = GLContext.getCurrent();
+ if (current == context) {
+ context.release();
+ }
+ context.destroy();
+ pbufferDrawable.destroy();
+ }
+ }
+ private DestroyAction destroyAction = new DestroyAction();
}