From 105657635735301b729daf613cad3628400a96c6 Mon Sep 17 00:00:00 2001 From: Kenneth Russel Date: Mon, 6 Mar 2006 02:32:13 +0000 Subject: Use try/finally in X11GLContext.destroyImpl() to avoid any potential problems in leaving AWT toolkit locked git-svn-id: file:///usr/local/projects/SUN/JOGL/git-svn/svn-server-sync/jogl/trunk@650 232f8b59-042b-4e1e-8c03-345bb8c30851 --- .../com/sun/opengl/impl/x11/X11GLContext.java | 31 ++++++++++++---------- 1 file changed, 17 insertions(+), 14 deletions(-) (limited to 'src/classes/com/sun/opengl') 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() { -- cgit v1.2.3