Long story short, the bug was in this code:
protected BugTreeModel(BugTreeModel other) {
this.root = new BugAspects(other.root);
this.sorter = other.sorter;
this.bugSet = new BugSet(other.bugSet);
this.bugTreeFilterListener = other.bugTreeFilterListener;
this.tree = other.tree;
this.filterActivity = other.filterActivity;
this.setTreeHolder(other.treeSwapper);
}
Pretty innocuous clone constructor, you might think. The problem is with the
bugTreeFilterListener
field. This field is an instance of an inner class. When that field gets copied over, so to does the implicit reference the inner class has to its outer class. This meant when the bugTreeFilterListener
was calling methods to the outer class (which holds the collection of bugs displayed), it was calling it on the old, source-of-the-clone, instance. Reconstructing the field solved the problem.Mental note to self: don't copy references of inner classes across instances of outer classes.
No comments:
Post a Comment