1
|
Index: actor/AtomicActor.java
|
2
|
===================================================================
|
3
|
--- actor/AtomicActor.java (revision 74770)
|
4
|
+++ actor/AtomicActor.java (working copy)
|
5
|
@@ -169,12 +169,27 @@
|
6
|
*/
|
7
|
@Override
|
8
|
public Object clone(Workspace workspace) throws CloneNotSupportedException {
|
9
|
+
|
10
|
+ // When super.clone() is called below, attributes that are
|
11
|
+ // contained in this actor are also cloned, which includes
|
12
|
+ // calling methods on these attributes such as setContainer().
|
13
|
+ // These methods may add themselves to the firing listeners
|
14
|
+ // or initializables lists in the newObject clone, so we do
|
15
|
+ // not want to clear these lists in newObject after super.clone().
|
16
|
+ // Instead, save this instance's lists here and restore them after
|
17
|
+ // call super.clone().
|
18
|
+ LinkedList<ActorFiringListener> oldActorFiringListeners = _actorFiringListeners;
|
19
|
+ _actorFiringListeners = null;
|
20
|
+ Set<Initializable> oldInitializables = _initializables;
|
21
|
+ _initializables = null;
|
22
|
+
|
23
|
@SuppressWarnings("unchecked")
|
24
|
AtomicActor<T> newObject = (AtomicActor<T>) super.clone(workspace);
|
25
|
-
|
26
|
+
|
27
|
+ _initializables = oldInitializables;
|
28
|
+ _actorFiringListeners = oldActorFiringListeners;
|
29
|
+
|
30
|
// Reset to force reinitialization of cache.
|
31
|
- newObject._actorFiringListeners = null;
|
32
|
- newObject._initializables = null;
|
33
|
newObject._inputPortsVersion = -1;
|
34
|
newObject._outputPortsVersion = -1;
|
35
|
newObject._cachedInputPorts = null;
|
36
|
Index: kernel/util/NamedObj.java
|
37
|
===================================================================
|
38
|
--- kernel/util/NamedObj.java (revision 74770)
|
39
|
+++ kernel/util/NamedObj.java (working copy)
|
40
|
@@ -493,6 +493,10 @@
|
41
|
// See 8.1.0 in NamedObj.tcl. Credit: Colin Endicott
|
42
|
newObject._debugListeners = null;
|
43
|
|
44
|
+ // Since _debugListeners is null, _debugging should be
|
45
|
+ // false to avoid error message in _debug()
|
46
|
+ newObject._debugging = false;
|
47
|
+
|
48
|
// During the cloning process, change requests might
|
49
|
// be issued (e.g. in an actor's _addEntity() method).
|
50
|
// Execution of these change requests need to be deferred
|