aboutsummaryrefslogtreecommitdiffstats
path: root/src/classes
diff options
context:
space:
mode:
authorKevin Rushforth <[email protected]>2006-11-07 22:02:04 +0000
committerKevin Rushforth <[email protected]>2006-11-07 22:02:04 +0000
commit216530730b56aae165d5fd08468c06fb7ab8dd08 (patch)
tree86ad383069c5bf4a4cde958fe03ee0abd91f04f8 /src/classes
parent6b79268326f663661c7dbb7fbf47d61f94f4fbea (diff)
Fixed issue 84: Rendering pauses after Canvas3D disposal until AWT event
This also supersedes the fix for the previously-reported JCanvas3D freeze (issue 131), and is a more robust solution. git-svn-id: https://svn.java.net/svn/j3d-core~svn/trunk@742 ba19aa83-45c5-6ac9-afd3-db810772062c
Diffstat (limited to 'src/classes')
-rw-r--r--src/classes/share/javax/media/j3d/Canvas3D.java32
-rw-r--r--src/classes/share/javax/media/j3d/MasterControl.java10
2 files changed, 25 insertions, 17 deletions
diff --git a/src/classes/share/javax/media/j3d/Canvas3D.java b/src/classes/share/javax/media/j3d/Canvas3D.java
index f617565..dd35eec 100644
--- a/src/classes/share/javax/media/j3d/Canvas3D.java
+++ b/src/classes/share/javax/media/j3d/Canvas3D.java
@@ -1309,21 +1309,21 @@ public class Canvas3D extends Canvas {
}
- if (rdr != null) {
- rdr.userStop = false;
- }
ctxTimeStamp = 0;
if ((view != null) && (view.universe != null)) {
view.universe.checkForEnableEvents();
}
- // Issue 131: Call redraw() if this is an auto-off-screen Canvas3D,
- // so it will start up correctly. It isn't necessary to do this for
- // on-screen Canvas3Ds because redraw() will be called when we
- // get the first paint().
- if (offScreen) {
- redraw();
- }
+ if (rdr != null) {
+ // Issue 84: Send a message to MC to restart renderer
+ // Note that this also obviates the need for the earlier fix to
+ // issue 131 which called redraw() for auto-off-screen Canvas3Ds
+ // (and this is a more robust fix)
+ VirtualUniverse.mc.postRequest(MasterControl.START_RENDERER, rdr);
+ while (rdr.userStop) {
+ MasterControl.threadYield();
+ }
+ }
}
// When this canvas is removed a frame, this notification gets called. We
@@ -1379,7 +1379,7 @@ public class Canvas3D extends Canvas {
visible = false;
screen.removeUser(this);
- evaluateActive();
+ evaluateActive();
VirtualUniverse.mc.freeCanvasId(canvasId);
canvasBit = 0;
@@ -1393,7 +1393,7 @@ public class Canvas3D extends Canvas {
// it will free graphics2D textureID
graphics2D = null;
- super.removeNotify();
+ super.removeNotify();
// This may happen if user explicity call this before
// addNotify()
@@ -1438,9 +1438,13 @@ public class Canvas3D extends Canvas {
added = false;
if (rdr != null) {
- rdr.userStop = false;
+ // Issue 84: Send a message to MC to restart renderer
+ VirtualUniverse.mc.postRequest(MasterControl.START_RENDERER, rdr);
+ while (rdr.userStop) {
+ MasterControl.threadYield();
+ }
}
-
+
// Fix for issue 102 removing strong reference and avoiding memory leak
// due retention of parent container
diff --git a/src/classes/share/javax/media/j3d/MasterControl.java b/src/classes/share/javax/media/j3d/MasterControl.java
index 89967fc..c8e6a50 100644
--- a/src/classes/share/javax/media/j3d/MasterControl.java
+++ b/src/classes/share/javax/media/j3d/MasterControl.java
@@ -2986,9 +2986,13 @@ class MasterControl {
threadListsChanged = true;
}
} else if (type == START_RENDERER) {
- Canvas3D c3d = (Canvas3D) o;
- if (!c3d.isFatalError()) {
- c3d.isRunningStatus = true;
+ if (o instanceof Canvas3D) {
+ Canvas3D c3d = (Canvas3D) o;
+ if (!c3d.isFatalError()) {
+ c3d.isRunningStatus = true;
+ }
+ } else {
+ ((Renderer) o).userStop = false;
}
threadListsChanged = true;
} else if (type == STOP_RENDERER) {