fix issue #997 (cloning UpdateControl throws IllegalArgumentException)

accellbaker
Stephen Gold 6 years ago
parent 000ac95fd4
commit fceee58546
  1. 5
      jme3-core/src/main/java/com/jme3/scene/control/UpdateControl.java

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2009-2018 jMonkeyEngine * Copyright (c) 2009-2019 jMonkeyEngine
* All rights reserved. * All rights reserved.
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without
@ -54,7 +54,7 @@ import java.util.concurrent.Future;
*/ */
public class UpdateControl extends AbstractControl { public class UpdateControl extends AbstractControl {
private final ConcurrentLinkedQueue<AppTask<?>> taskQueue = new ConcurrentLinkedQueue<AppTask<?>>(); private ConcurrentLinkedQueue<AppTask<?>> taskQueue = new ConcurrentLinkedQueue<>();
/** /**
* Enqueues a task/callable object to execute in the jME3 * Enqueues a task/callable object to execute in the jME3
@ -87,6 +87,7 @@ public class UpdateControl extends AbstractControl {
@Override @Override
public Object jmeClone() { public Object jmeClone() {
UpdateControl clone = (UpdateControl)super.jmeClone(); UpdateControl clone = (UpdateControl)super.jmeClone();
clone.taskQueue = new ConcurrentLinkedQueue<>();
// This is kind of questionable since the tasks aren't cloned and have // This is kind of questionable since the tasks aren't cloned and have
// no reference to the new spatial or anything. They'll get run again // no reference to the new spatial or anything. They'll get run again

Loading…
Cancel
Save