fix(editor): read the proxy cache off the UI thread; the Sync gate is known before the job list
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_012iLMBNwBE2GnphAsu4cjaC
This commit is contained in:
2 files changed
+7
-3
No files matched your search
@@ -69,7 +69,7 @@ public sealed class EditorViewModel : LocalizedViewModel, IAsyncDisposable
|
||||
private IThumbnailSource _thumbnails;
|
||||
private int _playLimit;
|
||||
private double? _analysisSecondsPerFrame;
|
||||
private ExportSyncGate _syncGate = ExportSyncGate.SignedOut;
|
||||
private ExportSyncGate _syncGate;
|
||||
private bool _disposed;
|
||||
|
||||
public EditorViewModel(ShellViewModel shell, EditorSession session, IReadOnlyList<IVideoEncoderProvider> encoders, EncoderHost host)
|
||||
@@ -103,6 +103,8 @@ public sealed class EditorViewModel : LocalizedViewModel, IAsyncDisposable
|
||||
Tabs = [Frames, Exposure, new MotionTab(this), new CameraTab(this), new TimeTab(this), new StackTab(this), new ExportTab(this)];
|
||||
_selectedTab = Exposure;
|
||||
_currentIndex = session.Project.HeroFrame is { } hero && (uint)hero < (uint)FrameCount ? hero : 0;
|
||||
// Until the link is read (AttachJobsAsync), a sequence of this PC cannot send its renders.
|
||||
_syncGate = session.IsRemote ? ExportSyncGate.Remote : ExportSyncGate.SignedOut;
|
||||
RenderChoices = [.. ExportPresets.BuiltIn.Select(p => new Choice(p.Id, p.NameKey))];
|
||||
|
||||
session.ProjectChanged += OnProjectChanged;
|
||||
@@ -484,11 +486,11 @@ public sealed class EditorViewModel : LocalizedViewModel, IAsyncDisposable
|
||||
/// </summary>
|
||||
public async Task AttachJobsAsync()
|
||||
{
|
||||
await RefreshSyncGateAsync();
|
||||
var jobs = await Session.Source.ListJobsAsync(CancellationToken.None);
|
||||
foreach (var job in jobs) Track(job);
|
||||
foreach (var job in jobs.OrderBy(j => j.Finished)) LearnAnalysisSpeed(job);
|
||||
OnBusyChanged();
|
||||
await RefreshSyncGateAsync();
|
||||
}
|
||||
|
||||
/// <summary>Reads again whether this sequence can send its renders to the signed-in server (session, link, rights).</summary>
|
||||
|
||||
@@ -131,7 +131,9 @@ public sealed class SequenceViewModel : SectionViewModel
|
||||
return local;
|
||||
}
|
||||
var sync = services.Sync;
|
||||
if (sync.Server is not { } server || sync.Service?.OpenRemote(server, sequenceId) is not { } remote) throw new InvalidOperationException(Loc.L("Editor.Error.Missing"));
|
||||
// The proxy cache's index and files are read off the UI thread.
|
||||
if (sync.Server is not { } server || sync.Service is not { } service || await Task.Run(() => service.OpenRemote(server, sequenceId)) is not { } remote)
|
||||
throw new InvalidOperationException(Loc.L("Editor.Error.Missing"));
|
||||
// An editor whose saves the server refuses would only lose edits.
|
||||
if (!sync.Policy.CanEdit) throw new InvalidOperationException(Loc.L("Editor.Error.RemoteReadOnly"));
|
||||
var api = sync.ConnectEditor() ?? throw new InvalidOperationException(Loc.L("Editor.Error.Missing"));
|
||||
|
||||
Reference in new issue
Block a user