diff options
Diffstat (limited to 'src')
6 files changed, 21 insertions, 11 deletions
diff --git a/src/classes/share/javax/media/j3d/GroupRetained.java b/src/classes/share/javax/media/j3d/GroupRetained.java index f69a14b..c6451a1 100644 --- a/src/classes/share/javax/media/j3d/GroupRetained.java +++ b/src/classes/share/javax/media/j3d/GroupRetained.java @@ -2451,7 +2451,8 @@ class GroupRetained extends NodeRetained implements BHLeafInterface { } } } else { - if (cachedBounds!=null && boundsAutoCompute) { + // Issue 514 : NPE in Wonderland : triggered in cached bounds computation + if (validCachedBounds && boundsAutoCompute) { bounds.combine(cachedBounds); return; } @@ -2483,7 +2484,8 @@ class GroupRetained extends NodeRetained implements BHLeafInterface { Bounds getBounds() { if ( boundsAutoCompute) { - if (cachedBounds!=null) { + // Issue 514 : NPE in Wonderland : triggered in cached bounds computation + if (validCachedBounds) { return (Bounds) cachedBounds.clone(); } diff --git a/src/classes/share/javax/media/j3d/NodeRetained.java b/src/classes/share/javax/media/j3d/NodeRetained.java index 6978854..e287c9b 100644 --- a/src/classes/share/javax/media/j3d/NodeRetained.java +++ b/src/classes/share/javax/media/j3d/NodeRetained.java @@ -141,7 +141,7 @@ abstract class NodeRetained extends SceneGraphObjectRetained implements NnuId { Bounds apiBounds; protected Bounds cachedBounds=null; // Cached auto compute bounds, could we use localBounds ? - + protected boolean validCachedBounds = false; // Fix to Issue 514 /** * Each element, p, of branchGroupPaths is a list of BranchGroup from * root of the tree to this. @@ -957,7 +957,8 @@ abstract class NodeRetained extends SceneGraphObjectRetained implements NnuId { // if the cachedBounds==null. However this is not the case // if the node is the child of a SharedGroup if (VirtualUniverse.mc.cacheAutoComputedBounds) { - cachedBounds = null; + // Issue 514 : NPE in Wonderland : triggered in cached bounds computation + validCachedBounds = false; if (parent!=null) { parent.dirtyBoundsCache(); } diff --git a/src/classes/share/javax/media/j3d/Shape3DRetained.java b/src/classes/share/javax/media/j3d/Shape3DRetained.java index b4ec88c..92a4a49 100644 --- a/src/classes/share/javax/media/j3d/Shape3DRetained.java +++ b/src/classes/share/javax/media/j3d/Shape3DRetained.java @@ -840,7 +840,8 @@ class Shape3DRetained extends LeafRetained { if(boundsAutoCompute) { // System.err.println("getBounds ---- localBounds is " + localBounds); - if (cachedBounds!=null) { + // Issue 514 : NPE in Wonderland : triggered in cached bounds computation + if (validCachedBounds) { return (Bounds) cachedBounds.clone(); } @@ -912,7 +913,9 @@ class Shape3DRetained extends LeafRetained { } } } else { - if (cachedBounds==null) { + // Issue 514 : NPE in Wonderland : triggered in cached bounds computation + if (!validCachedBounds) { + validCachedBounds = true; cachedBounds = new BoundingBox((BoundingBox) null); for(int i=0; i<geometryList.size(); i++) { diff --git a/src/classes/share/javax/media/j3d/SharedGroupRetained.java b/src/classes/share/javax/media/j3d/SharedGroupRetained.java index 7c0be0a..eaecb88 100644 --- a/src/classes/share/javax/media/j3d/SharedGroupRetained.java +++ b/src/classes/share/javax/media/j3d/SharedGroupRetained.java @@ -882,7 +882,8 @@ class SharedGroupRetained extends GroupRetained implements TargetsInterface { // if the cachedBounds==null. However this is not the case // if the node is the child of a SharedGroup if (VirtualUniverse.mc.cacheAutoComputedBounds) { - cachedBounds = null; + // Issue 514 : NPE in Wonderland : triggered in cached bounds computation + validCachedBounds = false; synchronized(parents) { Enumeration e = parents.elements(); while(e.hasMoreElements()) { diff --git a/src/classes/share/javax/media/j3d/SwitchRetained.java b/src/classes/share/javax/media/j3d/SwitchRetained.java index 3156d58..2a37bf7 100644 --- a/src/classes/share/javax/media/j3d/SwitchRetained.java +++ b/src/classes/share/javax/media/j3d/SwitchRetained.java @@ -639,7 +639,9 @@ class SwitchRetained extends GroupRetained implements TargetsInterface } } } else { - if (cachedBounds==null) { + // Issue 514 : NPE in Wonderland : triggered in cached bounds computation + if (!validCachedBounds) { + validCachedBounds = true; cachedBounds = new BoundingSphere(); ((BoundingSphere)cachedBounds).setRadius(-1); if(whichChild == Switch.CHILD_ALL) { @@ -685,7 +687,8 @@ class SwitchRetained extends GroupRetained implements TargetsInterface NodeRetained child; if(boundsAutoCompute) { - if (cachedBounds!=null) { + // Issue 514 : NPE in Wonderland : triggered in cached bounds computation + if (validCachedBounds) { return (Bounds) cachedBounds.clone(); } diff --git a/src/classes/share/javax/media/j3d/TransformGroupRetained.java b/src/classes/share/javax/media/j3d/TransformGroupRetained.java index 518c84d..d5a4e70 100644 --- a/src/classes/share/javax/media/j3d/TransformGroupRetained.java +++ b/src/classes/share/javax/media/j3d/TransformGroupRetained.java @@ -769,8 +769,8 @@ class TransformGroupRetained extends GroupRetained implements TargetsInterface void computeCombineBounds(Bounds bounds) { - - if (cachedBounds!=null && boundsAutoCompute) { + // Issue 514 : NPE in Wonderland : triggered in cached bounds computation + if (validCachedBounds && boundsAutoCompute) { Bounds b = (Bounds) cachedBounds.clone(); // Should this be lock too ? ( MT safe ? ) // Thoughts : |