Skip to content

Commit 22617c5

Browse files
committed
Fix memory leak from progressbar animation
1 parent 5bb9a73 commit 22617c5

File tree

1 file changed

+12
-2
lines changed

1 file changed

+12
-2
lines changed

recaf-ui/src/main/java/software/coley/recaf/ui/pane/WorkspaceInformationPane.java

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,8 @@ public WorkspaceInformationPane(@Nonnull TextProviderService textService,
6868
getStyleClass().add("background");
6969

7070
// Set up a "loading..." overlay while the summary is still being generated
71-
VBox box = new VBox(new RingProgressIndicator(ProgressIndicator.INDETERMINATE_PROGRESS),
71+
RingProgressIndicator ring = new RingProgressIndicator(ProgressIndicator.INDETERMINATE_PROGRESS);
72+
VBox box = new VBox(ring,
7273
new BoundLabel(Lang.getBinding("workspace.info-progress")));
7374
box.setAlignment(Pos.CENTER);
7475
box.setSpacing(20);
@@ -107,7 +108,16 @@ public WorkspaceInformationPane(@Nonnull TextProviderService textService,
107108

108109
// When the summary is done, clear the "loading..." overlay.
109110
CompletableFuture.allOf(summaryFutures.toArray(CompletableFuture[]::new))
110-
.whenCompleteAsync((ignored, error) -> FxThreadUtil.delayedRun(100, () -> modal.hide(true)));
111+
.whenCompleteAsync((ignored, error) -> FxThreadUtil.delayedRun(100, () -> {
112+
modal.hide(true);
113+
114+
// AtlantaFX's ring progress in the 'indeterminate' state uses the JavaFX 'RotateTransition' animation
115+
// which leaks memory if not explicitly stopped. This results in any workspace content never being GC'd.
116+
//
117+
// See: https://bsky.app/profile/mattcoley.bsky.social/post/3mbvlnisiys2z
118+
ring.setProgress(0);
119+
box.getChildren().clear();
120+
}));
111121
}
112122

113123
@Nonnull

0 commit comments

Comments
 (0)