by moving the wiring of the RaceLog listeners for TrackedRace into a validation callback using ObjectInputStream.registerValidation, bug 2506 seems solved

This commit is contained in:
Axel Uhl committed 2014-12-13 00:32:18 +01:00
1 parent de9d9f701d
commit f76172ae27
1 file changed
+6 -4
@@ -192,10 +192,12 @@ public abstract class AbstractRaceColumn extends SimpleAbstractRaceColumn implem
// is the tracked race's attachedRaceLogs field and the logListener field. The collections and the
// DynamicTrackedRaceLogListener are re-established after de-serialization in corresponding readObject(...)
// methods. However, the connections are not. That's what we need to do here, simply by invoking:
TrackedRace trackedRace = getTrackedRace(fleet);
if (trackedRace != null) {
trackedRace.attachRaceLog(raceLog);
}
ois.registerValidation(() -> {
TrackedRace trackedRace = getTrackedRace(fleet);
if (trackedRace != null) {
trackedRace.attachRaceLog(raceLog);
}
}, /* prio */ 0);
// because this will add the race log to the tracked race's attachedRaceLogs collection again, and
// the new DynamicTrackedRaceLogListener that the readObject(...) method had constructed for the
// tracked race will be added as a listener to the race log whose listeners collection otherwise would