Skip to content

fix: prevent Sparkline shutdown race - #46

Closed
000hen wants to merge 1 commit into
masterfrom
codex/fix-sparkline-shutdown-race
Closed

000hen wants to merge 1 commit into
masterfrom
codex/fix-sparkline-shutdown-race

Conversation

@000hen

@000hen 000hen commented Jul 20, 2026

Copy link
Copy Markdown
Owner

Summary / 摘要

  • Scope Sparkline collection subscriptions to its loaded lifetime and guard redraws before touching disconnected WinUI visuals.
  • Dispose cached server view models and their metrics streams when the navigation shell closes.
  • Add lifecycle regression tests covering unload-safe redraws and shutdown disposal ordering.

The root cause was a queued metrics update reaching Sparkline.Redraw() after the native Polyline had been released during app teardown, producing an intermittent empty COMException.

Testing / 測試

  • go test ./... (from engine/) — not run; no Go files changed.
  • dotnet test app/JustHostMC.Core.Tests/JustHostMC.Core.Tests.csproj — 38 tests passed.
  • I performed any relevant manual testing. / 我已完成相關的手動測試。 — not performed.
  • dotnet build JustHostMC.sln -p:Platform=x64 -p:SkipEngineBuild=true -p:SkipProtobufGenerate=true — succeeded with 0 warnings and 0 errors.

Checklist / 檢查清單

  • The change is focused and does not include unrelated edits. / 這項變更範圍明確,且未包含無關修改。
  • I updated tests for changed behavior where practical. / 我已在適當情況下更新測試,以涵蓋行為變更。
  • I updated documentation for user-facing or developer-facing changes. / 我已更新與使用者或開發者相關的文件。 (No documentation change was required.)
  • I regenerated protobuf outputs locally if files under proto/ changed. / 若修改了 proto/,我已在本機重新產生 protobuf 輸出。 (No protobuf files changed.)
  • I did not commit credentials, private server data, or generated build artifacts. / 我未提交憑證、私人伺服器資料或建置產物。

@000hen 000hen closed this Jul 20, 2026
@000hen
000hen deleted the codex/fix-sparkline-shutdown-race branch July 20, 2026 14:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant