summaryrefslogtreecommitdiffstats
path: root/src/nativewindow
diff options
context:
space:
mode:
Diffstat (limited to 'src/nativewindow')
-rw-r--r--src/nativewindow/classes/javax/media/nativewindow/GraphicsConfigurationFactory.java17
1 files changed, 13 insertions, 4 deletions
diff --git a/src/nativewindow/classes/javax/media/nativewindow/GraphicsConfigurationFactory.java b/src/nativewindow/classes/javax/media/nativewindow/GraphicsConfigurationFactory.java
index e5f230b4c..2610f2cfa 100644
--- a/src/nativewindow/classes/javax/media/nativewindow/GraphicsConfigurationFactory.java
+++ b/src/nativewindow/classes/javax/media/nativewindow/GraphicsConfigurationFactory.java
@@ -190,10 +190,19 @@ public abstract class GraphicsConfigurationFactory {
if (!(abstractGraphicsDeviceClass.isAssignableFrom(abstractGraphicsDeviceImplementor))) {
throw new IllegalArgumentException("Given class must implement AbstractGraphicsDevice");
}
- GraphicsConfigurationFactory prevFactory = registeredFactories.put(abstractGraphicsDeviceImplementor, factory);
- if(DEBUG) {
- System.err.println("GraphicsConfigurationFactory.registerFactory() "+abstractGraphicsDeviceImplementor+" -> "+factory+
- ", overridding: "+prevFactory);
+ final GraphicsConfigurationFactory prevFactory;
+ if(null == factory) {
+ prevFactory = registeredFactories.remove(abstractGraphicsDeviceImplementor);
+ if(DEBUG) {
+ System.err.println("GraphicsConfigurationFactory.registerFactory() remove "+abstractGraphicsDeviceImplementor+
+ ", deleting: "+prevFactory);
+ }
+ } else {
+ prevFactory = registeredFactories.put(abstractGraphicsDeviceImplementor, factory);
+ if(DEBUG) {
+ System.err.println("GraphicsConfigurationFactory.registerFactory() put "+abstractGraphicsDeviceImplementor+" -> "+factory+
+ ", overridding: "+prevFactory);
+ }
}
return prevFactory;
}