From ff98f568eb6ae6b3973337d3b2370e8ed7b86dac Mon Sep 17 00:00:00 2001 From: MhaWay Date: Wed, 20 May 2026 19:07:39 +0200 Subject: [PATCH] Close connecting window when entering bootstrap flow --- Source/Client/Networking/State/ClientJoiningState.cs | 10 ++++++++++ Source/Client/Windows/ConnectingWindow.cs | 4 ++++ 2 files changed, 14 insertions(+) diff --git a/Source/Client/Networking/State/ClientJoiningState.cs b/Source/Client/Networking/State/ClientJoiningState.cs index 1e8a98d3a..560a3b6da 100644 --- a/Source/Client/Networking/State/ClientJoiningState.cs +++ b/Source/Client/Networking/State/ClientJoiningState.cs @@ -127,6 +127,16 @@ void StartDownloading() { if (bootstrapState is { Enabled: true } state) { + var connectingWindows = Find.WindowStack.Windows + .OfType() + .ToList(); + + foreach (var connectingWindow in connectingWindows) + { + connectingWindow.suppressPostCloseActions = true; + Find.WindowStack.TryRemove(connectingWindow); + } + connection.ChangeState(ConnectionStateEnum.ClientBootstrap); Find.WindowStack.Add(new BootstrapConfiguratorWindow(connection, state)); return; diff --git a/Source/Client/Windows/ConnectingWindow.cs b/Source/Client/Windows/ConnectingWindow.cs index 11aef7617..1e05e0e31 100644 --- a/Source/Client/Windows/ConnectingWindow.cs +++ b/Source/Client/Windows/ConnectingWindow.cs @@ -14,6 +14,7 @@ public abstract class BaseConnectingWindow : Window, IConnectionStatusListener protected abstract string ConnectingString { get; } public bool returnToServerBrowser; + public bool suppressPostCloseActions; protected string result; // Only show this window if there aren't any others during connecting @@ -117,6 +118,9 @@ public override void DoWindowContents(Rect inRect) public override void PostClose() { + if (suppressPostCloseActions) + return; + Multiplayer.StopMultiplayer(); if (returnToServerBrowser)