src/share/classes/java/awt/Dialog.java

Print this page

        

@@ -1035,11 +1035,11 @@
             Component predictedFocusOwner = null;
             try {
                 predictedFocusOwner = getMostRecentFocusOwner();
                 if (conditionalShow(predictedFocusOwner, time)) {
                     modalFilter = ModalEventFilter.createFilterForDialog(this);
-                    Conditional cond = new Conditional() {
+                    final Conditional cond = new Conditional() {
                         @Override
                         public boolean evaluate() {
                             return windowClosingException == null;
                         }
                     };

@@ -1065,11 +1065,16 @@
                         }
                     }
 
                     modalityPushed();
                     try {
-                        EventQueue eventQueue = Toolkit.getDefaultToolkit().getSystemEventQueue();
+                        final EventQueue eventQueue = AccessController.doPrivileged(
+                            new PrivilegedAction<EventQueue>() {
+                                public EventQueue run() {
+                                    return Toolkit.getDefaultToolkit().getSystemEventQueue();
+                                }
+                        });
                         secondaryLoop = eventQueue.createSecondaryLoop(cond, modalFilter, 0);
                         if (!secondaryLoop.enter()) {
                             secondaryLoop = null;
                         }
                     } finally {