From 64af11278dfe4d3feb223775e0b3a83a968fcabc Mon Sep 17 00:00:00 2001 From: Sven Gothel Date: Thu, 7 Jul 2011 03:41:25 +0200 Subject: Fix SharedResource (SR) Initialization - Catch exceptions in SR thread avoiding deadlock in blocking caller thread - Catch NPE on SR queries to return null if appropriate --- .../opengl/x11/glx/X11GLXDrawableFactory.java | 49 +++++++++++++--------- 1 file changed, 30 insertions(+), 19 deletions(-) (limited to 'src/jogl/classes/jogamp/opengl/x11/glx') diff --git a/src/jogl/classes/jogamp/opengl/x11/glx/X11GLXDrawableFactory.java b/src/jogl/classes/jogamp/opengl/x11/glx/X11GLXDrawableFactory.java index 8d9de8144..48f9dd875 100644 --- a/src/jogl/classes/jogamp/opengl/x11/glx/X11GLXDrawableFactory.java +++ b/src/jogl/classes/jogamp/opengl/x11/glx/X11GLXDrawableFactory.java @@ -289,27 +289,36 @@ public class X11GLXDrawableFactory extends GLDrawableFactoryImpl { } public final String getGLXVendorName(AbstractGraphicsDevice device) { - SharedResourceRunner.Resource sr = sharedResourceRunner.getOrCreateShared(device); - if(null!=sr) { - return ((SharedResource)sr).getGLXVendorName(); + if(null != device) { + SharedResourceRunner.Resource sr = sharedResourceRunner.getOrCreateShared(device); + if(null!=sr) { + return ((SharedResource)sr).getGLXVendorName(); + } + return GLXUtil.getVendorName(device.getHandle()); } - return GLXUtil.getVendorName(device.getHandle()); + return null; } public final boolean isGLXVendorATI(AbstractGraphicsDevice device) { - SharedResourceRunner.Resource sr = sharedResourceRunner.getOrCreateShared(device); - if(null!=sr) { - return ((SharedResource)sr).isGLXVendorATI(); + if(null != device) { + SharedResourceRunner.Resource sr = sharedResourceRunner.getOrCreateShared(device); + if(null!=sr) { + return ((SharedResource)sr).isGLXVendorATI(); + } + return GLXUtil.isVendorATI(device.getHandle()); } - return GLXUtil.isVendorATI(device.getHandle()); + return false; } public final boolean isGLXVendorNVIDIA(AbstractGraphicsDevice device) { - SharedResourceRunner.Resource sr = sharedResourceRunner.getOrCreateShared(device); - if(null!=sr) { - return ((SharedResource)sr).isGLXVendorNVIDIA(); + if(null != device) { + SharedResourceRunner.Resource sr = sharedResourceRunner.getOrCreateShared(device); + if(null!=sr) { + return ((SharedResource)sr).isGLXVendorNVIDIA(); + } + return GLXUtil.isVendorNVIDIA(device.getHandle()); } - return GLXUtil.isVendorNVIDIA(device.getHandle()); + return false; } protected final void shutdownInstance() { @@ -366,13 +375,15 @@ public class X11GLXDrawableFactory extends GLDrawableFactoryImpl { } public final boolean isGLXVersionGreaterEqualOneThree(AbstractGraphicsDevice device) { - SharedResource sr = (SharedResource) sharedResourceRunner.getOrCreateShared(device); - if(null!=sr) { - return sr.isGLXVersionGreaterEqualOneThree(); - } - if( device instanceof X11GraphicsDevice ) { - VersionNumber v = getGLXVersion( (X11GraphicsDevice) device); - return ( null != v ) ? v.compareTo(versionOneThree) >= 0 : false ; + if(null != device) { + SharedResource sr = (SharedResource) sharedResourceRunner.getOrCreateShared(device); + if(null!=sr) { + return sr.isGLXVersionGreaterEqualOneThree(); + } + if( device instanceof X11GraphicsDevice ) { + VersionNumber v = getGLXVersion( (X11GraphicsDevice) device); + return ( null != v ) ? v.compareTo(versionOneThree) >= 0 : false ; + } } return false; } -- cgit v1.2.3