changeset 89:c9ee9428aea9

6636331: ConcurrentModificationException in AppContext code Summary: Added synchronization to AppContext.getAppContexts() Reviewed-by: art
author son
date Thu, 13 Mar 2008 16:51:04 +0300
parents bbd8e20d5052
children 86a5780cad99
files src/share/classes/sun/awt/AppContext.java
diffstat 1 files changed, 3 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/src/share/classes/sun/awt/AppContext.java	Thu Mar 13 16:47:40 2008 +0300
+++ b/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