From 849ba51ce2b2937e4e41af1f1366c94763027a2d Mon Sep 17 00:00:00 2001 From: Stanley Dimant Date: Mon, 20 Mar 2023 11:05:15 +0100 Subject: [PATCH] do not use actionqueue for redraws --- MareSynchronos/Interop/IpcManager.cs | 8 ++++++-- .../ServerConfiguration/ServerConfigurationManager.cs | 6 ++++++ 2 files changed, 12 insertions(+), 2 deletions(-) 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(); }