diff options
-rw-r--r-- | src/nativewindow/classes/javax/media/nativewindow/DefaultGraphicsConfiguration.java | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/src/nativewindow/classes/javax/media/nativewindow/DefaultGraphicsConfiguration.java b/src/nativewindow/classes/javax/media/nativewindow/DefaultGraphicsConfiguration.java index 47f02c7cc..42350e6c1 100644 --- a/src/nativewindow/classes/javax/media/nativewindow/DefaultGraphicsConfiguration.java +++ b/src/nativewindow/classes/javax/media/nativewindow/DefaultGraphicsConfiguration.java @@ -40,8 +40,10 @@ public class DefaultGraphicsConfiguration implements Cloneable, AbstractGraphics public DefaultGraphicsConfiguration(AbstractGraphicsScreen screen, Capabilities capsChosen, Capabilities capsRequested) { this.screen = screen; - this.capabilitiesChosen = capsChosen; - this.capabilitiesRequested = capsRequested; + + // Create "immutable" copies of capabilities. + this.capabilitiesChosen = (Capabilities) capsChosen.clone(); + this.capabilitiesRequested = (Capabilities) capsRequested.clone(); } public Object clone() { @@ -56,12 +58,14 @@ public class DefaultGraphicsConfiguration implements Cloneable, AbstractGraphics return screen; } + // TODO: Return immutable instance. public Capabilities getChosenCapabilities() { - return (null!=capabilitiesChosen)?(Capabilities)capabilitiesChosen.clone():null; + return capabilitiesChosen; } + // TODO: Return immutable instance. public Capabilities getRequestedCapabilities() { - return (null!=capabilitiesRequested)?(Capabilities)capabilitiesRequested.clone():null; + return capabilitiesRequested; } public AbstractGraphicsConfiguration getNativeGraphicsConfiguration() { |