fix(desktop): harden cancellation, dispose, and lifecycle races across main services
Cancel pending result-popup measure timers on hideResultPopup; track CaptionService aux-model load state, stop deduplication, and refine abort epochs across restarts; forward per-call AbortSignal through VoiceModeService and LlmGateway to LocalLLMService and abort pull streams plus availability polling on dispose; clear aborted response pointers and gate stale mic start errors in VoiceConversationService; guard AudioCaptureService stopping resume against exited SoX processes and cleanup failed starts; abort LocalSTTService downloadModel polling on dispose; and fail closed when desktopCapturer.getSources rejects in caption loopback setup.
This commit is contained in:
parent
4bf0f0df12
commit
fc5d45312c
19 changed files with 922 additions and 94 deletions
|
|
@ -139,4 +139,23 @@ describe('WindowManager popup hide/show timer race regressions', () => {
|
|||
await vi.advanceTimersByTimeAsync(160)
|
||||
expect(wm.isCommandPopupVisible()).toBe(false)
|
||||
})
|
||||
|
||||
it('hideResultPopup_calledBeforeMeasureTimeout_cancelsPendingShowAndStaysHidden', async () => {
|
||||
const wm = await import('../../../src/main/windows/WindowManager')
|
||||
|
||||
wm.showResultPopup('hello world', 5000)
|
||||
const popupWin = state.windows[0]
|
||||
expect(popupWin?.visible).toBe(true)
|
||||
|
||||
// Hide before RESULT_MEASURE_TIMEOUT_MS (400ms) fires
|
||||
await vi.advanceTimersByTimeAsync(100)
|
||||
wm.hideResultPopup()
|
||||
expect(popupWin?.visible).toBe(false)
|
||||
|
||||
const sendsBeforeTimeout = popupWin?.webContents.send.mock.calls.length ?? 0
|
||||
await vi.advanceTimersByTimeAsync(500)
|
||||
|
||||
expect(popupWin?.visible).toBe(false)
|
||||
expect(popupWin?.webContents.send.mock.calls.length ?? 0).toBe(sendsBeforeTimeout)
|
||||
})
|
||||
})
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue