6636331: ConcurrentModificationException in AppContext code
authorson
Thu, 13 Mar 2008 16:51:04 +0300
changeset 112 c7ed16a1bef2
parent 111 adfeae7879c2
child 113 d35e2fc341c7
6636331: ConcurrentModificationException in AppContext code Summary: Added synchronization to AppContext.getAppContexts() Reviewed-by: art
jdk/src/share/classes/sun/awt/AppContext.java
--- a/jdk/src/share/classes/sun/awt/AppContext.java	Thu Mar 13 16:47:40 2008 +0300
+++ b/jdk/src/share/classes/sun/awt/AppContext.java	Thu Mar 13 16:51:04 2008 +0300
@@ -146,7 +146,9 @@
      * Returns a set containing all <code>AppContext</code>s.
      */
     public static Set<AppContext> getAppContexts() {
-        return new HashSet<AppContext>(threadGroup2appContext.values());
+        synchronized (threadGroup2appContext) {
+            return new HashSet<AppContext>(threadGroup2appContext.values());
+        }
     }
 
     /* The main "system" AppContext, used by everything not otherwise