src/share/classes/sun/awt/AWTAutoShutdown.java

Print this page

        

@@ -230,15 +230,21 @@
      * <code>peerMap</code> is empty and <code>toolkitThreadBusy</code>
      * is false and <code>busyThreadSet</code> is empty.
      *
      * @return true if AWT is in ready-to-shutdown state.
      */
-    private boolean isReadyToShutdown() {
+    public boolean isReadyToShutdown() {
+        // We need to synchronize here since the method is public.
+        // The peerMap states it wants activationLock as well,
+        // but run() doesn't use it when calling this method,
+        // so we won't either.
+        synchronized (mainLock) {
         return (!toolkitThreadBusy &&
                  peerMap.isEmpty() &&
                  busyThreadSet.isEmpty());
     }
+    }
 
     /**
      * Notify about the toolkit thread state change.
      *
      * @param busy true if the toolkit thread state changes from idle