changeset 4951:0a2518e15882

Fixed RT29844: Create PrinterJob hangs on Mac
author prr
date Tue, 03 Sep 2013 13:51:37 -0700
parents e0f3abebc024
children 977346aedf74
files modules/graphics/src/main/java/com/sun/prism/j2d/print/J2DPrinterJob.java
diffstat 1 files changed, 6 insertions(+), 35 deletions(-) [+]
line wrap: on
line diff
--- a/modules/graphics/src/main/java/com/sun/prism/j2d/print/J2DPrinterJob.java	Tue Sep 03 09:40:03 2013 -0700
+++ b/modules/graphics/src/main/java/com/sun/prism/j2d/print/J2DPrinterJob.java	Tue Sep 03 13:51:37 2013 -0700
@@ -130,19 +130,13 @@
 
     private class PrintDialogRunnable implements Runnable {
 
-        volatile boolean inNestedLoop = true;
-
         public void run() {
             boolean rv = false;
             try {
                 rv = pJob2D.printDialog(printReqAttrSet);
             } catch (Exception e) {
             } finally {
-                synchronized (this) {
-                    inNestedLoop = false;
-                    Application.invokeLater(new ExitLoopRunnable(this, rv));
-                    this.notify();
-                }
+                Application.invokeLater(new ExitLoopRunnable(this, rv));
             }
         }
     }
@@ -152,16 +146,8 @@
         Thread prtThread = new Thread(dr, "FX Print Dialog Thread");
         prtThread.start();
         // the nested event loop will return after the runnable exits.
-        Object rv = null;
-        synchronized (dr) {
-            if (dr.inNestedLoop) {
-                try {
-                    dr.wait();
-                } catch (InterruptedException e) {
-                }
-                rv = Toolkit.getToolkit().enterNestedEventLoop(dr);
-            }
-        }
+        Object rv = Toolkit.getToolkit().enterNestedEventLoop(dr);
+
         boolean rvbool = false;
         try {
             rvbool = ((Boolean)rv).booleanValue();
@@ -193,20 +179,14 @@
 
     private class PageDialogRunnable implements Runnable {
 
-        volatile boolean inNestedLoop = true;
-
         public void run() {
             PageFormat pf = null;
             try {
                 pf = pJob2D.pageDialog(printReqAttrSet);
             } catch (Exception e) {
             } finally {
-                synchronized (this) {
-                    inNestedLoop = false;
-                    Boolean rv = Boolean.valueOf(pf != null);
-                    Application.invokeLater(new ExitLoopRunnable(this, rv));
-                    this.notify();
-                }
+                Boolean rv = Boolean.valueOf(pf != null);
+                Application.invokeLater(new ExitLoopRunnable(this, rv));
             }
         }
     }
@@ -217,16 +197,7 @@
         Thread prtThread = new Thread(dr, "FX Page Setup Dialog Thread");
         prtThread.start();
         // the nested event loop will return after the runnable exits.
-        Object rv = null;
-        synchronized (dr) {
-            if (dr.inNestedLoop) {
-                try {
-                    dr.wait();
-                } catch (InterruptedException e) {
-                }
-                rv = Toolkit.getToolkit().enterNestedEventLoop(dr);
-            }
-        }
+        Object rv = Toolkit.getToolkit().enterNestedEventLoop(dr);
         boolean rvbool = false;
         try {
             rvbool = ((Boolean)rv).booleanValue();