keep a reference to public unmodifiable view of fileids so that listeners are not immediately garbage colelcted

This commit is contained in:
jmillman 2015-06-11 14:48:50 -04:00
parent 00d9b24714
commit 13fefb1c17

View File

@ -41,13 +41,15 @@ public class DrawableGroup implements Comparable<DrawableGroup> {
} }
private final ObservableList<Long> fileIDs = FXCollections.observableArrayList(); private final ObservableList<Long> fileIDs = FXCollections.observableArrayList();
private final ObservableList<Long> unmodifiableFileIDS = FXCollections.unmodifiableObservableList(fileIDs);
//cache the number of files in this groups with hashset hits //cache the number of files in this groups with hashset hits
private long hashSetHitsCount = -1; private long hashSetHitsCount = -1;
private final ReadOnlyBooleanWrapper seen = new ReadOnlyBooleanWrapper(false); private final ReadOnlyBooleanWrapper seen = new ReadOnlyBooleanWrapper(false);
@SuppressWarnings("ReturnOfCollectionOrArrayField")
synchronized public ObservableList<Long> fileIds() { synchronized public ObservableList<Long> fileIds() {
return FXCollections.unmodifiableObservableList(fileIDs); return unmodifiableFileIDS;
} }
final public GroupKey<?> groupKey; final public GroupKey<?> groupKey;