From bf32672536d275e5125cd11d094fb91fd5190c6c Mon Sep 17 00:00:00 2001 From: Jonas Herzig Date: Sun, 26 Mar 2023 19:21:30 +0200 Subject: [PATCH] Fix active timeline changes affecting render queue (fixes #814) The `Timeline` type is mutable, so we need to create a copy before we pass it to GuiKeyframeRepository because we don't want anything stored in there (or more specifically in render queue which can also be added to from that gui) to be affected by subsequent changes. --- .../java/com/replaymod/simplepathing/gui/GuiPathing.java | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/main/java/com/replaymod/simplepathing/gui/GuiPathing.java b/src/main/java/com/replaymod/simplepathing/gui/GuiPathing.java index d2117cf8..560d5d4b 100644 --- a/src/main/java/com/replaymod/simplepathing/gui/GuiPathing.java +++ b/src/main/java/com/replaymod/simplepathing/gui/GuiPathing.java @@ -395,8 +395,11 @@ public class GuiPathing { public void keyframeRepoButtonPressed() { abortPathPlayback(); try { + TimelineSerialization serialization = new TimelineSerialization(mod.getCurrentTimeline(), null); + String serialized = serialization.serialize(Collections.singletonMap("", mod.getCurrentTimeline().getTimeline())); + Timeline currentTimeline = serialization.deserialize(serialized).get(""); GuiKeyframeRepository gui = new GuiKeyframeRepository( - mod.getCurrentTimeline(), replayHandler.getReplayFile(), mod.getCurrentTimeline().getTimeline()); + mod.getCurrentTimeline(), replayHandler.getReplayFile(), currentTimeline); Futures.addCallback(gui.getFuture(), new FutureCallback() { @Override public void onSuccess(Timeline result) {