diff options
author | Sven Gothel <[email protected]> | 2011-11-26 08:24:56 +0100 |
---|---|---|
committer | Sven Gothel <[email protected]> | 2011-11-26 08:24:56 +0100 |
commit | 26e6aac665d0fede32c322b66d90e82a622624ac (patch) | |
tree | 9d83021273fc3cdfb27359478833522356d21f2c /src/jogl | |
parent | 6c1aa039afc4b81eeacdc97993cd7c7b2efc6ea4 (diff) |
SharedResourceRunner: Use generics ; X11GLXDrawableFactory.SharedRunnable shutdown: don't attempt to close Display device.
Diffstat (limited to 'src/jogl')
3 files changed, 17 insertions, 17 deletions
diff --git a/src/jogl/classes/jogamp/opengl/SharedResourceRunner.java b/src/jogl/classes/jogamp/opengl/SharedResourceRunner.java index 5979056f3..e24a9f8ed 100644 --- a/src/jogl/classes/jogamp/opengl/SharedResourceRunner.java +++ b/src/jogl/classes/jogamp/opengl/SharedResourceRunner.java @@ -50,7 +50,7 @@ public class SharedResourceRunner implements Runnable { Resource mapPut(String connection, Resource resource); Resource mapGet(String connection); - Collection/*<Resource>*/ mapValues(); + Collection<Resource> mapValues(); } Implementation impl = null; @@ -246,10 +246,9 @@ public class SharedResourceRunner implements Runnable { } private void releaseSharedResources() { - Collection/*<Resource>*/ sharedResources = impl.mapValues(); - for (Iterator iter = sharedResources.iterator(); iter.hasNext();) { - Resource sr = (Resource) iter.next(); - impl.releaseSharedResource(sr); + Collection<Resource> sharedResources = impl.mapValues(); + for (Iterator<Resource> iter = sharedResources.iterator(); iter.hasNext();) { + impl.releaseSharedResource(iter.next()); } impl.clear(); } diff --git a/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsWGLDrawableFactory.java b/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsWGLDrawableFactory.java index 3cbe5c8e5..9838ba156 100644 --- a/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsWGLDrawableFactory.java +++ b/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsWGLDrawableFactory.java @@ -128,7 +128,7 @@ public class WindowsWGLDrawableFactory extends GLDrawableFactoryImpl { SharedResourceImplementation sharedResourceImpl; SharedResourceRunner sharedResourceRunner; Thread sharedResourceThread; - HashMap/*<connection, SharedResource>*/ sharedMap = new HashMap(); + HashMap<String /*connection*/, SharedResourceRunner.Resource> sharedMap = new HashMap<String, SharedResourceRunner.Resource>(); long processAffinityChanges = 0; PointerBuffer procMask = PointerBuffer.allocateDirect(1); @@ -250,15 +250,15 @@ public class WindowsWGLDrawableFactory extends GLDrawableFactoryImpl { } public SharedResourceRunner.Resource mapPut(String connection, SharedResourceRunner.Resource resource) { synchronized(sharedMap) { - return (SharedResourceRunner.Resource) sharedMap.put(connection, resource); + return sharedMap.put(connection, resource); } } public SharedResourceRunner.Resource mapGet(String connection) { synchronized(sharedMap) { - return (SharedResourceRunner.Resource) sharedMap.get(connection); + return sharedMap.get(connection); } } - public Collection/*<Resource>*/ mapValues() { + public Collection<SharedResourceRunner.Resource> mapValues() { synchronized(sharedMap) { return sharedMap.values(); } @@ -269,9 +269,6 @@ public class WindowsWGLDrawableFactory extends GLDrawableFactoryImpl { sharedDevice.lock(); try { AbstractGraphicsScreen absScreen = new DefaultGraphicsScreen(sharedDevice, 0); - if (null == absScreen) { - throw new GLException("Couldn't create shared screen for device: "+sharedDevice+", idx 0"); - } GLProfile glp = GLProfile.get(sharedDevice, GLProfile.GL_PROFILE_LIST_MIN_DESKTOP); if (null == glp) { throw new GLException("Couldn't get default GLProfile for device: "+sharedDevice); diff --git a/src/jogl/classes/jogamp/opengl/x11/glx/X11GLXDrawableFactory.java b/src/jogl/classes/jogamp/opengl/x11/glx/X11GLXDrawableFactory.java index 5dfbffeaf..acaf1a599 100644 --- a/src/jogl/classes/jogamp/opengl/x11/glx/X11GLXDrawableFactory.java +++ b/src/jogl/classes/jogamp/opengl/x11/glx/X11GLXDrawableFactory.java @@ -119,7 +119,7 @@ public class X11GLXDrawableFactory extends GLDrawableFactoryImpl { SharedResourceImplementation sharedResourceImpl; SharedResourceRunner sharedResourceRunner; Thread sharedResourceThread; - HashMap<String /* connection */, SharedResourceRunner.Resource> sharedMap = new HashMap<String, SharedResourceRunner.Resource>(); + HashMap<String /* connection */, SharedResourceRunner.Resource> sharedMap = new HashMap<String, SharedResourceRunner.Resource>(); static class SharedResource implements SharedResourceRunner.Resource { X11GraphicsDevice device; @@ -188,7 +188,9 @@ public class X11GLXDrawableFactory extends GLDrawableFactoryImpl { public SharedResourceRunner.Resource createSharedResource(String connection) { X11GraphicsDevice sharedDevice = new X11GraphicsDevice(X11Util.openDisplay(connection), AbstractGraphicsDevice.DEFAULT_UNIT, - NativeWindowFactory.getNullToolkitLock(), true); // own non-shared display connection, no locking + true); // own non-shared display connection, no locking + // new X11GraphicsDevice(X11Util.openDisplay(connection), AbstractGraphicsDevice.DEFAULT_UNIT, + // NativeWindowFactory.getNullToolkitLock(), true); // own non-shared display connection, no locking sharedDevice.lock(); try { GLXUtil.initGLXClientDataSingleton(sharedDevice); @@ -253,12 +255,14 @@ public class X11GLXDrawableFactory extends GLDrawableFactoryImpl { } if (null != sr.context) { - // may cause JVM SIGSEGV: sharedContext.destroy(); + // may cause JVM SIGSEGV: + // sr.context.makeCurrent(); + // sr.context.destroy(); sr.context = null; } if (null != sr.drawable) { - // may cause JVM SIGSEGV: sharedDrawable.destroy(); + // may cause JVM SIGSEGV: sr.drawable.destroy(); sr.drawable = null; } @@ -267,7 +271,7 @@ public class X11GLXDrawableFactory extends GLDrawableFactoryImpl { } if (null != sr.device) { - sr.device.close(); + // may cause JVM SIGSEGV: sr.device.close(); sr.device = null; } } |