summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/classes/com/sun/opengl/impl/x11/X11GLContext.java31
1 files changed, 17 insertions, 14 deletions
diff --git a/src/classes/com/sun/opengl/impl/x11/X11GLContext.java b/src/classes/com/sun/opengl/impl/x11/X11GLContext.java
index 54d1c62f3..fa0265e7e 100644
--- a/src/classes/com/sun/opengl/impl/x11/X11GLContext.java
+++ b/src/classes/com/sun/opengl/impl/x11/X11GLContext.java
@@ -168,22 +168,25 @@ public abstract class X11GLContext extends GLContextImpl {
protected void destroyImpl() throws GLException {
lockToolkit();
- if (context != 0) {
- if (DEBUG) {
- System.err.println("glXDestroyContext(0x" +
- Long.toHexString(mostRecentDisplay) +
- ", 0x" +
- Long.toHexString(context) + ")");
- }
- GLX.glXDestroyContext(mostRecentDisplay, context);
- if (DEBUG) {
- System.err.println("!!! Destroyed OpenGL context " + context);
+ try {
+ if (context != 0) {
+ if (DEBUG) {
+ System.err.println("glXDestroyContext(0x" +
+ Long.toHexString(mostRecentDisplay) +
+ ", 0x" +
+ Long.toHexString(context) + ")");
+ }
+ GLX.glXDestroyContext(mostRecentDisplay, context);
+ if (DEBUG) {
+ System.err.println("!!! Destroyed OpenGL context " + context);
+ }
+ context = 0;
+ mostRecentDisplay = 0;
+ GLContextShareSet.contextDestroyed(this);
}
- context = 0;
- mostRecentDisplay = 0;
- GLContextShareSet.contextDestroyed(this);
+ } finally {
+ unlockToolkit();
}
- unlockToolkit();
}
public boolean isCreated() {