# HG changeset patch
# User son
# Date 1205416264 -10800
#      Thu Mar 13 16:51:04 2008 +0300
# Node ID c9ee9428aea9baa8e32691db1e14744002c70def
# Parent  bbd8e20d50523bbd89d10204e4f337a844f3cef1
6636331: ConcurrentModificationException in AppContext code
Summary: Added synchronization to AppContext.getAppContexts()
Reviewed-by: art

diff --git a/src/share/classes/sun/awt/AppContext.java b/src/share/classes/sun/awt/AppContext.java
--- openjdk/jdk/src/share/classes/sun/awt/AppContext.java
+++ openjdk/jdk/src/share/classes/sun/awt/AppContext.java
@@ -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
