7124400: [macosx] CGraphicsDevice.getConfigurations() returns reference to member (does not copy configs)
authorbae
Mon, 21 May 2012 14:04:46 +0400
changeset 12636 03f4fb9b26be
parent 12603 926e0735f658
child 12637 983d636eed7c
7124400: [macosx] CGraphicsDevice.getConfigurations() returns reference to member (does not copy configs) Reviewed-by: anthony, kizune
jdk/src/macosx/classes/sun/awt/CGraphicsDevice.java
jdk/test/java/awt/GraphicsDevice/CloneConfigsTest.java
--- a/jdk/src/macosx/classes/sun/awt/CGraphicsDevice.java	Thu May 10 10:25:14 2012 -0700
+++ b/jdk/src/macosx/classes/sun/awt/CGraphicsDevice.java	Mon May 21 14:04:46 2012 +0400
@@ -40,7 +40,7 @@
     private final int displayID;
 
     // Array of all GraphicsConfig instances for this device
-    private final CGraphicsConfig[] configs;
+    private final GraphicsConfiguration[] configs;
 
     // Default config (temporarily hard coded)
     private final int DEFAULT_CONFIG = 0;
@@ -49,7 +49,7 @@
 
     public CGraphicsDevice(int displayID) {
         this.displayID = displayID;
-        configs = new CGraphicsConfig[] {
+        configs = new GraphicsConfiguration[] {
             CGLGraphicsConfig.getConfig(this, 0)
         };
     }
@@ -66,7 +66,7 @@
      */
     @Override
     public GraphicsConfiguration[] getConfigurations() {
-        return configs;
+        return configs.clone();
     }
 
     /**
--- a/jdk/test/java/awt/GraphicsDevice/CloneConfigsTest.java	Thu May 10 10:25:14 2012 -0700
+++ b/jdk/test/java/awt/GraphicsDevice/CloneConfigsTest.java	Mon May 21 14:04:46 2012 +0400
@@ -23,7 +23,7 @@
 
 /*
  * @test
- * @bug     6822057
+ * @bug     6822057 7124400
  *
  * @summary Test verifies that list of supported graphics configurations
  *          can not be changed via modification of elements of an array