Skip to content

TTS review: destroy mpv cores off the UI thread in Stop and row playback - #13684

Merged
niksedk merged 1 commit into
mainfrom
claude/subtitleedit-issue-analysis-2f1793
Aug 16, 2026
Merged

TTS review: destroy mpv cores off the UI thread in Stop and row playback#13684
niksedk merged 1 commit into
mainfrom
claude/subtitleedit-issue-analysis-2f1793

Conversation

@niksedk

@niksedk niksedk commented Aug 16, 2026

Copy link
Copy Markdown
Member

Follow-up to the #13376 fix, for #13567 (still crashing in beta 14).

The reporter's beta 14 crash has the byte-identical fault offset as the beta 11 report: an access violation during IFrameworkInputPane.Unadvise while the TTS window's native window disposes. #13376's off-thread teardown covered the TTS window's voice preview and the review window's OnClosing, but two sites in ReviewSpeechViewModel still ran mpv_terminate_destroy on the UI thread:

  • Stop() disposed the playback core inline.
  • PlayAudio() disposed the previous core inline before creating the next one — so playing a second row, or just letting auto-continue advance through rows, tore down a core on the UI thread at every transition.

Both now route through the existing DisposePlayerOffThread, and PlayAudio adopts the local-variable pattern from TextToSpeechViewModel.PlayAudio (no half-initialized player left in _mpvContext on init failure, no null-deref race on LoadAudio).

Since the crash is machine-specific and uncatchable, this also adds tools-log breadcrumbs: review window play/stop/OK/Cancel/closing, mpv dispose start/finish in both windows, and a line on each side of the TTS window's Window.Close() call — a log ending between those two lines pinpoints the native crash.

Tests: dotnet test tests/UI/UITests.csproj --filter "FullyQualifiedName~TextToSpeech|FullyQualifiedName~ReviewSpeech" — 171 passed.

🤖 Generated with Claude Code

#13376 moved the TTS preview player's teardown to a worker thread because
mpv_terminate_destroy on the UI thread corrupts state that later fails as
an uncatchable access violation in IFrameworkInputPane.Unadvise when a
window closes (#13567). That fix missed two sites in the review window:
the Stop command and the row-to-row swap in PlayAudio (which the
auto-continue timer drives on every transition) still disposed the core
inline on the UI thread. Route both through DisposePlayerOffThread.

Also add tools-log breadcrumbs to the review window's play/stop/close
paths and on both sides of the TTS window's Window.Close() call, so the
next crash report shows exactly how far teardown got.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@niksedk
niksedk merged commit 6d5229f into main Aug 16, 2026
1 check passed
@niksedk
niksedk deleted the claude/subtitleedit-issue-analysis-2f1793 branch August 16, 2026 04:49
@niksedk niksedk mentioned this pull request Aug 16, 2026
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