Close Iris GUI windows on the Swing thread when the plugin shuts down

Windows otherwise outlive the plugin and keep drawing with threads its shutdown has stopped. GuiHost.closeWindows disposes every managed frame on the Swing thread and waits at most 5 s, in case that thread is itself waiting on the server. The Bukkit plugin runs it with its post-shutdown cleanup and the modded stop sequence runs it before clearing the GUI host.

v3: 6793e34d8
This commit is contained in:
piexel committed 2026-11-10 10:28:12 +01:00
1 parent 7e4c159039
commit 88ee0e89f7
4 files changed
+57 -2

No files matched your search

@@ -56,6 +56,7 @@ import art.arcane.iris.core.link.MultiverseCoreLink;
import art.arcane.iris.core.agent.AttachSignal;
import art.arcane.iris.core.nms.INMS;
import art.arcane.iris.core.gui.BukkitGuiHost;
import art.arcane.iris.core.gui.GuiHost;
import art.arcane.iris.core.gui.PregeneratorJob;
import art.arcane.iris.core.service.BoardSVC;
import art.arcane.iris.core.service.CommandSVC;
@@ -845,6 +846,7 @@ public class Iris extends VolmitPlugin implements Listener, ReloadAware {
return;
}
BukkitGuiHost.install();
postShutdown(GuiHost::closeWindows);
// super.onEnable() already registers this instance as a listener.
super.onEnable();
if (IrisStartupValidation.isRestartRequired()) {
@@ -183,6 +183,7 @@ public final class ModdedEngineBootstrap {
failure = runStopStage(failure, "block break handler", ModdedBlockBreakHandler::clear);
failure = runStopStage(failure, "studio bridges", StudioBridges::closeAll);
failure = runStopStage(failure, "studio commands", ModdedStudioCommands::clear);
failure = runStopStage(failure, "gui windows", GuiHost::closeWindows);
failure = runStopStage(failure, "gui host", ModdedGuiHost::clear);
failure = runStopStage(failure, "services", () -> services().disableAll());
reportStopFailure("stopping", failure);