-
Notifications
You must be signed in to change notification settings - Fork 267
Open
Description
It is possible for the AnimatedLabel::createSpinningLine component's thread to hang after the WaitingDialog that owns it is closed.
A quick fix could be to explicitly call AnimatedLabel::stopAnimation in WaitingDIalog::close (the spinning line would need to become an instance variable of the WaitingDialog class).
Although, I think a better solution would be some fix within the AnimatedLabel class itself.
Proof of Concept:
final DefaultTerminalFactory terminalFactory = new DefaultTerminalFactory();
try (final Screen screen = terminalFactory.createScreen()) {
screen.startScreen();
// POC
final WindowBasedTextGUI textGUI = new MultiWindowTextGUI(screen);
final WaitingDialog waitingDialog = WaitingDialog.createDialog("TITLE", "TEXT");
waitingDialog.showDialog(textGUI, false);
CompletableFuture.runAsync(() -> {
try {
Thread.sleep(5000);
} catch (final InterruptedException e) {
Thread.currentThread().interrupt();
throw new RuntimeException(e);
} finally {
waitingDialog.close();
}
}, Executors.newSingleThreadExecutor())
.exceptionally(e -> {
throw new RuntimeException(e);
});
waitingDialog.waitUntilClosed();
System.out.println("WAIT DIALOG CLOSED");
} catch (final IOException e) {
throw new RuntimeException(e);
}thomashuss
Metadata
Metadata
Assignees
Labels
No labels