diff --git a/docs/launcher.md b/docs/launcher.md
index 942662c..786c6f0 100644
--- a/docs/launcher.md
+++ b/docs/launcher.md
@@ -1530,6 +1530,7 @@ A Gateway built before the mode would start for real, so Waypoint first asks `co
The list is read from the checkout's save database (`auth.db` and `characters.db` from LocalExile's database split on, or an
old `saves.db` until the servers migrate it) through the adapter, with nothing running or built: every account with
its characters, nothing secret. Showing the section reads it; **Reload accounts** reads it again.
+When a monitored server or the client stops, Waypoint checks the current workspace again before enabling account edits.
**Register** and **Create** are the dev protocol's `register`, `login` and `create_character` (the server's GettingStarted
step 8), so they work beside running servers. The character is created in Standard; the game's own creation screen offers
diff --git a/src/Waypoint.Linux/Views/AccountsTab.axaml.cs b/src/Waypoint.Linux/Views/AccountsTab.axaml.cs
index 5b3af73..29efbf6 100644
--- a/src/Waypoint.Linux/Views/AccountsTab.axaml.cs
+++ b/src/Waypoint.Linux/Views/AccountsTab.axaml.cs
@@ -32,7 +32,16 @@ public void Attach(Shared shared)
StopHost.IsEnabled = up;
});
shared.Workspace.Changed += () => Dispatcher.UIThread.Post(ShowAccess);
- shared.LiveRunning += running => Dispatcher.UIThread.Post(ShowAccess);
+ shared.Monitor.Exited += (service, _) =>
+ {
+ if (service.Kind != ServiceKind.Recorder)
+ Dispatcher.UIThread.Post(async () => await shared.Workspace.RefreshAfterRuntimeStopAsync());
+ };
+ shared.LiveRunning += running => Dispatcher.UIThread.Post(async () =>
+ {
+ ShowAccess();
+ if (!running) await shared.Workspace.RefreshAfterRuntimeStopAsync();
+ });
L.Current.PropertyChanged += (_, _) =>
{
ShowTexts();
diff --git a/src/Waypoint/AccountsTab.xaml.cs b/src/Waypoint/AccountsTab.xaml.cs
index a3d992b..fae46ec 100644
--- a/src/Waypoint/AccountsTab.xaml.cs
+++ b/src/Waypoint/AccountsTab.xaml.cs
@@ -31,7 +31,16 @@ internal void Attach(Shared shared)
StopHost.IsEnabled = up;
});
shared.Workspace.Changed += () => Dispatcher.BeginInvoke(ShowAccess);
- shared.LiveRunning += running => Dispatcher.BeginInvoke(ShowAccess);
+ shared.Monitor.Exited += (service, _) =>
+ {
+ if (service.Kind != ServiceKind.Recorder)
+ Dispatcher.BeginInvoke(async () => await shared.Workspace.RefreshAfterRuntimeStopAsync());
+ };
+ shared.LiveRunning += running => Dispatcher.BeginInvoke(async () =>
+ {
+ ShowAccess();
+ if (!running) await shared.Workspace.RefreshAfterRuntimeStopAsync();
+ });
L.Current.PropertyChanged += (_, _) => { AccountGrid.Items.Refresh(); CharacterGrid.Items.Refresh(); ShowAccess(); };
// Showing the section reads the list: the adapter needs no server for that.
IsVisibleChanged += async (_, e) => { if ((bool)e.NewValue) await Load(); };
diff --git a/src/Waypoint/Workspace.cs b/src/Waypoint/Workspace.cs
index 7d27498..c17589c 100644
--- a/src/Waypoint/Workspace.cs
+++ b/src/Waypoint/Workspace.cs
@@ -13,6 +13,7 @@ sealed class Workspace(Shared shared)
readonly RuntimeClient _client = new(BridgeScripts.Extract());
readonly StringBuilder _operations = new();
bool _inspecting;
+ bool _runtimeStoppedDuringInspection;
/// The last successful inspection; null before the first one.
public RuntimeSnapshot? Latest { get; private set; }
@@ -34,19 +35,36 @@ sealed class Workspace(Shared shared)
/// An operation failed: its stage, why, and its log when it has one.
public event Action? Failed;
+ // A monitor sample can see several services exit while an inspection is in progress. Recheck once at its end
+ // so the last exit is reflected even if the adapter had already taken its process snapshot.
+ public Task RefreshAfterRuntimeStopAsync()
+ {
+ if (shared.IsLiveRunning || Latest is not ({ HasServers: true } or { GameRunning: true }
+ or { AccountWriteBlockedReason.Length: > 0 } or { EditConflicts.Length: > 0 })) return Task.CompletedTask;
+ _runtimeStoppedDuringInspection = _inspecting;
+ return RefreshAsync();
+ }
+
public async Task RefreshAsync()
{
if (_inspecting || shared.IsLiveRunning) return;
_inspecting = true;
try
{
- var result = await _client.RunAsync(shared.Settings.ForBridge, "Inspect");
- Latest = result is { Ok: true, Snapshot: not null } ? result.Snapshot : Latest;
- InspectError = result.Ok ? null : result.Message;
- }
- catch (Exception e) when (e is IOException or UnauthorizedAccessException or System.Text.Json.JsonException or System.ComponentModel.Win32Exception)
- {
- InspectError = e.Message;
+ do
+ {
+ _runtimeStoppedDuringInspection = false;
+ try
+ {
+ var result = await _client.RunAsync(shared.Settings.ForBridge, "Inspect");
+ Latest = result is { Ok: true, Snapshot: not null } ? result.Snapshot : Latest;
+ InspectError = result.Ok ? null : result.Message;
+ }
+ catch (Exception e) when (e is IOException or UnauthorizedAccessException or System.Text.Json.JsonException or System.ComponentModel.Win32Exception)
+ {
+ InspectError = e.Message;
+ }
+ } while (_runtimeStoppedDuringInspection && !shared.IsLiveRunning);
}
finally { _inspecting = false; }
Changed?.Invoke();