diff options
author | Sven Gothel <[email protected]> | 2012-02-25 20:09:25 +0100 |
---|---|---|
committer | Sven Gothel <[email protected]> | 2012-02-25 20:09:25 +0100 |
commit | cc16e21c5601c3c9433b1e021addbbc9534a6e5a (patch) | |
tree | ec94403aa8fc66647e7e654395460f26baec6e64 /src/jogl/classes/jogamp/opengl/x11/glx | |
parent | aee3a75ad87ef3da0652c6b917ccdfda63a1230d (diff) |
Include GraphicsConfigurationFactory in lifecycle (initSingleton/shutdown) - fixes recursion on fallback GraphicsConfigurationFactory
.. also validate the X11 GraphicsConfigurationFactory in X11GLXGraphicsConfigurationFactory and fail fast
Diffstat (limited to 'src/jogl/classes/jogamp/opengl/x11/glx')
-rw-r--r-- | src/jogl/classes/jogamp/opengl/x11/glx/X11GLXGraphicsConfigurationFactory.java | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/src/jogl/classes/jogamp/opengl/x11/glx/X11GLXGraphicsConfigurationFactory.java b/src/jogl/classes/jogamp/opengl/x11/glx/X11GLXGraphicsConfigurationFactory.java index e77cba9d0..5122ac5bb 100644 --- a/src/jogl/classes/jogamp/opengl/x11/glx/X11GLXGraphicsConfigurationFactory.java +++ b/src/jogl/classes/jogamp/opengl/x11/glx/X11GLXGraphicsConfigurationFactory.java @@ -69,7 +69,15 @@ public class X11GLXGraphicsConfigurationFactory extends GLGraphicsConfigurationF static X11GLCapabilities.XVisualIDComparator XVisualIDComparator = new X11GLCapabilities.XVisualIDComparator(); static GraphicsConfigurationFactory fallbackX11GraphicsConfigurationFactory = null; static void registerFactory() { - fallbackX11GraphicsConfigurationFactory = GraphicsConfigurationFactory.registerFactory(javax.media.nativewindow.x11.X11GraphicsDevice.class, new X11GLXGraphicsConfigurationFactory()); + final GraphicsConfigurationFactory newFactory = new X11GLXGraphicsConfigurationFactory(); + final GraphicsConfigurationFactory oldFactory = GraphicsConfigurationFactory.registerFactory(javax.media.nativewindow.x11.X11GraphicsDevice.class, newFactory); + if(oldFactory == newFactory) { + throw new InternalError("GraphicsConfigurationFactory lifecycle impl. error"); + } + if(null == oldFactory) { + throw new InternalError("Missing fallback GraphicsConfigurationFactory"); + } + fallbackX11GraphicsConfigurationFactory = oldFactory; } private X11GLXGraphicsConfigurationFactory() { } |