From ab764138afd7597597e7519ce7324a623e54e24d Mon Sep 17 00:00:00 2001 From: sudacode Date: Sat, 28 Nov 2026 04:33:56 -0800 Subject: [PATCH] fix(subsync): recheck cancellation after the secondary selection read --- src/core/services/subsync-files.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/core/services/subsync-files.ts b/src/core/services/subsync-files.ts index 2af41957..36f50d8b 100644 --- a/src/core/services/subsync-files.ts +++ b/src/core/services/subsync-files.ts @@ -509,10 +509,11 @@ export async function loadSyncedSubtitle( if (addedTrackId === null) { throw new Error('Synchronized subtitle did not appear in the mpv track list'); } - signal?.throwIfAborted(); // The lookup polls for a while; if the user picked another secondary track meanwhile, // keep their choice (and delay) rather than overriding it. - if ((await client.requestProperty('secondary-sid')) !== secondaryBeforeAdd) { + const secondaryAfterLookup = await client.requestProperty('secondary-sid'); + signal?.throwIfAborted(); + if (secondaryAfterLookup !== secondaryBeforeAdd) { throw new Error( `Secondary subtitle changed while loading; saved the synced file at ${pathToLoad} without selecting it.`, );