diff options
author | Sven Gothel <[email protected]> | 2011-07-07 03:41:25 +0200 |
---|---|---|
committer | Sven Gothel <[email protected]> | 2011-07-07 03:41:25 +0200 |
commit | 64af11278dfe4d3feb223775e0b3a83a968fcabc (patch) | |
tree | 2582ce5972a2fbd58b72ff48fb92ed9d33bec794 /src/jogl/classes/jogamp/opengl/x11 | |
parent | 29cc5fa0375026c09bcbfed16627fe9eb6c97846 (diff) |
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
Diffstat (limited to 'src/jogl/classes/jogamp/opengl/x11')
-rw-r--r-- | src/jogl/classes/jogamp/opengl/x11/glx/X11GLXDrawableFactory.java | 49 |
1 files changed, 30 insertions, 19 deletions
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; } |