From 7b97aa387b8933c7e0ba61256fe3b11b1b8b189b Mon Sep 17 00:00:00 2001 From: Kevin Rushforth Date: Wed, 3 Nov 2004 20:57:14 +0000 Subject: 1. Fixed a problem in setOffScreenBuffer that prevented native off-screen buffer from being created after a live scene graph was removed. With yesterday's fix, this caused a deadlock to occur. 2. Cleanup in construction of the MasterControl object. git-svn-id: https://svn.java.net/svn/j3d-core~svn/trunk@68 ba19aa83-45c5-6ac9-afd3-db810772062c --- src/classes/share/javax/media/j3d/Canvas3D.java | 2 -- src/classes/share/javax/media/j3d/MasterControl.java | 13 +++++++++++++ .../share/javax/media/j3d/VirtualUniverse.java | 19 +------------------ 3 files changed, 14 insertions(+), 20 deletions(-) (limited to 'src/classes/share') diff --git a/src/classes/share/javax/media/j3d/Canvas3D.java b/src/classes/share/javax/media/j3d/Canvas3D.java index 5b2af1f..4505897 100644 --- a/src/classes/share/javax/media/j3d/Canvas3D.java +++ b/src/classes/share/javax/media/j3d/Canvas3D.java @@ -1127,8 +1127,6 @@ public class Canvas3D extends Canvas { (J3dI18N.getString("Canvas3D17")); } - VirtualUniverse.createMC(); - this.offScreen = offScreen; this.graphicsConfiguration = graphicsConfiguration; diff --git a/src/classes/share/javax/media/j3d/MasterControl.java b/src/classes/share/javax/media/j3d/MasterControl.java index 04cf953..e6ddcc3 100644 --- a/src/classes/share/javax/media/j3d/MasterControl.java +++ b/src/classes/share/javax/media/j3d/MasterControl.java @@ -2792,6 +2792,19 @@ class MasterControl { J3dDebug.doAssert((Screen3D.deviceRendererMap.get(gd) != null), "Screen3D.deviceRendererMap.get(gd) != null"); + // Create the master control thread if it isn't already created + boolean needToSetWork = false; + synchronized (mcThreadLock) { + if (mcThread == null) { + //System.err.println("Calling createMasterControlThread()"); + createMasterControlThread(); + needToSetWork = true; + } + } + if (needToSetWork) { + setWork(); + } + // Fix for Issue 72 : call createRenderer rather than getting // the renderer from the canvas.screen object Renderer rdr = createRenderer(c.graphicsConfiguration); diff --git a/src/classes/share/javax/media/j3d/VirtualUniverse.java b/src/classes/share/javax/media/j3d/VirtualUniverse.java index 9d9273d..26a34db 100644 --- a/src/classes/share/javax/media/j3d/VirtualUniverse.java +++ b/src/classes/share/javax/media/j3d/VirtualUniverse.java @@ -144,9 +144,6 @@ public class VirtualUniverse extends Object { // Root ThreadGroup for creating Java 3D threads static ThreadGroup rootThreadGroup; - // Lock for MasterControl Object creation - static Object mcLock = new Object(); - // Properties object for getProperties private static J3dQueryProps properties = null; @@ -192,20 +189,6 @@ public class VirtualUniverse extends Object { } - static void createMC() { - synchronized (mcLock) { - if (mc == null) { - mc = new MasterControl(); - } - } - } - - static void destroyMC() { - synchronized (mcLock) { - mc = null; - } - } - /** * Initialize the native interface and anything else that needs * to be initialized. @@ -252,7 +235,7 @@ public class VirtualUniverse extends Object { // Load the native libraries and create the static // MasterControl object MasterControl.loadLibraries(); - createMC(); + mc = new MasterControl(); // Print out debugging information for debug builds if(VersionInfo.isDebug) { -- cgit v1.2.3