changeset 9826:f7321fdc37a8

Merge
author asaha
date Wed, 28 May 2014 12:45:12 -0700
parents 5c6dbbfe11c1 bd5f7651116e
children 9f200f2cfe66
files .hgtags src/windows/classes/sun/awt/windows/ThemeReader.java src/windows/classes/sun/awt/windows/WToolkit.java src/windows/classes/sun/awt/windows/WWindowPeer.java
diffstat 5 files changed, 38 insertions(+), 14 deletions(-) [+]
line wrap: on
line diff
--- a/.hgtags	Tue May 27 11:02:36 2014 -0700
+++ b/.hgtags	Wed May 28 12:45:12 2014 -0700
@@ -279,6 +279,7 @@
 69ea8bc3ce29eda152d9c2ebea91a9ce233bde9e jdk8u11-b07
 bec9dcd4c06358154cce431c4b70da56530827de jdk8u11-b08
 801e730c85eb822ac3b00466b32d42e089cb7233 jdk8u11-b09
+105753f0465e534e3664d0935016f5a0d061829d jdk8u11-b10
 9543b632ab87368c887d8b29b21157ebb44228d0 jdk8u20-b02
 5a9f04957f826ce23639479c9791c7d8fd282b01 jdk8u20-b03
 c347889445c1153f11aaa56092d44a911e497454 jdk8u20-b04
--- a/src/windows/classes/sun/awt/windows/ThemeReader.java	Tue May 27 11:02:36 2014 -0700
+++ b/src/windows/classes/sun/awt/windows/ThemeReader.java	Wed May 28 12:45:12 2014 -0700
@@ -60,18 +60,12 @@
         new ReentrantReadWriteLock();
     private static final Lock readLock = readWriteLock.readLock();
     private static final Lock writeLock = readWriteLock.writeLock();
+    private static volatile boolean valid = false;
 
     static void flush() {
-        writeLock.lock();
-        try {
-            // Close old themes.
-            for (Long value : widgetToTheme.values()) {
-                closeTheme(value.longValue());
-            }
-            widgetToTheme.clear();
-        } finally {
-            writeLock.unlock();
-        }
+        // Could be called on Toolkit thread, so do not try to aquire locks
+        // to avoid deadlock with theme initialization
+        valid = false;
     }
 
     public static native boolean isThemed();
@@ -98,6 +92,24 @@
     // returns theme value
     // this method should be invoked with readLock locked
     private static Long getTheme(String widget) {
+        if (!valid) {
+            readLock.unlock();
+            writeLock.lock();
+            try {
+                if (!valid) {
+                    // Close old themes.
+                    for (Long value : widgetToTheme.values()) {
+                        closeTheme(value);
+                    }
+                    widgetToTheme.clear();
+                    valid = true;
+                }
+            } finally {
+                readLock.lock();
+                writeLock.unlock();
+            }
+        }
+
         // mostly copied from the javadoc for ReentrantReadWriteLock
         Long theme = widgetToTheme.get(widget);
         if (theme == null) {
--- a/src/windows/classes/sun/awt/windows/WToolkit.java	Tue May 27 11:02:36 2014 -0700
+++ b/src/windows/classes/sun/awt/windows/WToolkit.java	Wed May 28 12:45:12 2014 -0700
@@ -929,7 +929,16 @@
      * Windows doesn't always send WM_SETTINGCHANGE when it should.
      */
     private void windowsSettingChange() {
-        EventQueue.invokeLater(this::updateProperties);
+        if (AppContext.getAppContext() == null) {
+            // We cannot post the update to any EventQueue. Listeners will
+            // be called on EDTs by DesktopPropertyChangeSupport
+            updateProperties();
+        } else {
+            // Cannot update on Toolkit thread.
+            // DesktopPropertyChangeSupport will call listeners on Toolkit
+            // thread if it has AppContext (standalone mode)
+            EventQueue.invokeLater(this::updateProperties);
+        }
     }
 
     private synchronized void updateProperties() {
--- a/src/windows/classes/sun/awt/windows/WWindowPeer.java	Tue May 27 11:02:36 2014 -0700
+++ b/src/windows/classes/sun/awt/windows/WWindowPeer.java	Wed May 28 12:45:12 2014 -0700
@@ -452,6 +452,7 @@
     @SuppressWarnings("unchecked")
     public static long[] getActiveWindowHandles() {
         AppContext appContext = AppContext.getAppContext();
+        if (appContext == null) return null;
         synchronized (appContext) {
             List<WWindowPeer> l = (List<WWindowPeer>)appContext.get(ACTIVE_WINDOWS_KEY);
             if (l == null) {
--- a/test/java/lang/SecurityManager/CheckPackageAccess.java	Tue May 27 11:02:36 2014 -0700
+++ b/test/java/lang/SecurityManager/CheckPackageAccess.java	Wed May 28 12:45:12 2014 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -23,7 +23,7 @@
 
 /*
  *  @test
- *  @bug 6741606 7146431 8000450 8019830 8022945
+ *  @bug 6741606 7146431 8000450 8019830 8022945 8027144 8041633
  *  @summary Make sure all restricted packages listed in the package.access
  *           property in the java.security file are blocked
  *  @run main/othervm CheckPackageAccess
@@ -84,7 +84,8 @@
         "org.jcp.xml.dsig.internal.",
         "jdk.internal.",
         "jdk.nashorn.internal.",
-        "jdk.nashorn.tools."
+        "jdk.nashorn.tools.",
+        "com.sun.activation.registries."
     };
 
     public static void main(String[] args) throws Exception {