diff --git a/MareSynchronos/Interop/IpcManager.cs b/MareSynchronos/Interop/IpcManager.cs index d430687..718cc0a 100644 --- a/MareSynchronos/Interop/IpcManager.cs +++ b/MareSynchronos/Interop/IpcManager.cs @@ -605,12 +605,12 @@ public sealed class IpcManager : DisposableMediatorSubscriberBase _penumbraRedrawRequests[obj.Address] = !fireAndForget; - ActionQueue.Enqueue(action); - try { if (!fireAndForget) { + await _dalamudUtil.RunOnFrameworkThread(action); + var disposeToken = _disposalCts.Token; var combinedToken = CancellationTokenSource.CreateLinkedTokenSource(disposeToken, token).Token; @@ -619,6 +619,10 @@ public sealed class IpcManager : DisposableMediatorSubscriberBase if (!combinedToken.IsCancellationRequested) await _dalamudUtil.WaitWhileCharacterIsDrawing(logger, obj, applicationId, 30000, combinedToken).ConfigureAwait(false); } + else + { + _ = _dalamudUtil.RunOnFrameworkThread(action); + } } finally { diff --git a/MareSynchronos/Services/ServerConfiguration/ServerConfigurationManager.cs b/MareSynchronos/Services/ServerConfiguration/ServerConfigurationManager.cs index 192d269..b2929fb 100644 --- a/MareSynchronos/Services/ServerConfiguration/ServerConfigurationManager.cs +++ b/MareSynchronos/Services/ServerConfiguration/ServerConfigurationManager.cs @@ -209,6 +209,12 @@ public class ServerConfigurationManager internal void DeleteServer(ServerStorage selectedServer) { + if (Array.IndexOf(_configService.Current.ServerStorage.ToArray(), selectedServer) < + _configService.Current.CurrentServer) + { + _configService.Current.CurrentServer--; + } + _configService.Current.ServerStorage.Remove(selectedServer); Save(); }