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,15 +1065,20 @@
                         }
                     }
 
                     modalityPushed();
                     try {
+                        AccessController.doPrivileged(new PrivilegedAction<Void>() {
+                            public Void run() {
                         EventQueue eventQueue = Toolkit.getDefaultToolkit().getSystemEventQueue();
                         secondaryLoop = eventQueue.createSecondaryLoop(cond, modalFilter, 0);
                         if (!secondaryLoop.enter()) {
                             secondaryLoop = null;
                         }
+                                return null;
+                            }
+                        });
                     } finally {
                         modalityPopped();
                     }
 
                     // if this dialog is toolkit-modal, its filter must be removed