* 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
3.0
sha..rd 14 years ago
parent 548eb26428
commit 2611139702
  1. 21
      engine/src/core/com/jme3/scene/Node.java

@ -149,15 +149,13 @@ public class Node extends Spatial implements Savable {
@Override @Override
public void updateLogicalState(float tpf){ public void updateLogicalState(float tpf){
super.updateLogicalState(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); Spatial child = children.get(i);
child.updateLogicalState(tpf); 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; return children;
} }
/**
* Dead code
*
* @param geometry
* @param index1
* @param index2
* @deprecated Dead code
*/
@Deprecated
public void childChange(Geometry geometry, int index1, int index2) { public void childChange(Geometry geometry, int index1, int index2) {
//just pass to parent //just pass to parent
if(parent != null) { if(parent != null) {

Loading…
Cancel
Save