2
0
Эх сурвалжийг харах

* Fixed a possible issue where updateLogicalState could cause an IndexOutOfBoundsException

git-svn-id: https://jmonkeyengine.googlecode.com/svn/trunk@7167 75d07b2b-3a1a-0410-a2c5-0572b91ccdca
sha..rd 14 жил өмнө
parent
commit
2611139702

+ 14 - 7
engine/src/core/com/jme3/scene/Node.java

@@ -149,15 +149,13 @@ public class Node extends Spatial implements Savable {
     @Override
     public void updateLogicalState(float tpf){
         super.updateLogicalState(tpf);
-        for (int i = 0, cSize = children.size(); i < cSize; i++) {
+
+        // FIXME: Iterating through the children list backwards
+        // to avoid IndexOutOfBoundsException. This is sometimes unreliable,
+        // a more robust solution is needed.
+        for (int i = children.size(); i >= 0; i--){
             Spatial child = children.get(i);
             child.updateLogicalState(tpf);
-            
-            // added this line so that nodes removed by Controls
-            // don't cause IndexOutOfBoundsExceptions
-            // FIXME: This is sometimes unreliable, a more
-            // robust solution is needed
-            cSize = children.size();
         }
     }
 
@@ -477,6 +475,15 @@ public class Node extends Spatial implements Savable {
         return children;
     }
 
+    /**
+     * Dead code
+     * 
+     * @param geometry
+     * @param index1
+     * @param index2
+     * @deprecated Dead code
+     */
+    @Deprecated
     public void childChange(Geometry geometry, int index1, int index2) {
         //just pass to parent
         if(parent != null) {