--- old/javafx-ui-quantum/src/com/sun/javafx/tk/quantum/QuantumToolkit.java 2011-06-06 17:47:46.375976500 +0400 +++ new/javafx-ui-quantum/src/com/sun/javafx/tk/quantum/QuantumToolkit.java 2011-06-06 17:47:45.763671800 +0400 @@ -254,14 +254,22 @@ // restart the toolkit if previously terminated private void assertToolkitRunning() { - /* - * The restart path needs to be worked on - and synchronized - * such that the init() / startup() is not called multiple times - */ - /* if (toolkitRunning.get() == false) { + if (toolkitRunning.get() == false) { init(); - startup(null); - }*/ + + final CountDownLatch initLatch = new CountDownLatch(1); + startup(new Runnable() { + @Override + public void run() { + initLatch.countDown(); + } + }); + try { + initLatch.await(); + } catch (InterruptedException z) { + z.printStackTrace(System.err); + } + } } @Override public void finishLaunching(String args[]) { --- old/prism-d3d/src/com/sun/prism/d3d/D3DPipeline.java 2011-06-06 17:47:57.018554600 +0400 +++ new/prism-d3d/src/com/sun/prism/d3d/D3DPipeline.java 2011-06-06 17:47:56.322265600 +0400 @@ -21,10 +21,10 @@ */ public class D3DPipeline extends GraphicsPipeline { - private static final boolean d3dEnabled; + private static boolean isInited = false; + private static boolean d3dEnabled; static { - final boolean ar[] = { false }; AccessController.doPrivileged(new PrivilegedAction() { public Object run() { if (PrismSettings.verbose) { @@ -34,14 +34,10 @@ if (PrismSettings.verbose) { System.out.println("prism-d3d loaded."); } - ar[0] = (nInit(PrismSettings.class) == 0); + _init(); return null; } }); - if (PrismSettings.verbose) { - System.out.println("(X)d3dEnabled =" + ar[0]); - } - d3dEnabled = ar[0]; } static D3DPipeline theInstance; @@ -54,8 +50,20 @@ } return theInstance; } - + + @Override public boolean init() { + return _init(); + } + + public static boolean _init() { + if (!isInited) { + d3dEnabled = (nInit(PrismSettings.class) == 0); + if (PrismSettings.verbose) { + System.out.println("(X)d3dEnabled =" + d3dEnabled); + } + isInited = true; + } return d3dEnabled; } @@ -67,6 +75,11 @@ @Override public void dispose() { nDispose(); + isInited = false; + if (!factories.isEmpty()) { + factories.get(0).publicNotifyReset(); + } + factories.clear(); super.dispose(); }