From 488fd2997886bcc7052cefed75c709c3aaaea0bf Mon Sep 17 00:00:00 2001 From: Abe Jellinek <1770299+AbeJellinek@users.noreply.github.com> Date: Thu, 16 Apr 2026 16:25:54 -0400 Subject: [PATCH] Read Aloud: Handle failure when trying to pause other tab https://forums.zotero.org/discussion/130920/tts-breaks-after-automatic-theme-changes --- chrome/content/zotero/xpcom/reader.js | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/chrome/content/zotero/xpcom/reader.js b/chrome/content/zotero/xpcom/reader.js index 0b01a05894..b98ec9bf13 100644 --- a/chrome/content/zotero/xpcom/reader.js +++ b/chrome/content/zotero/xpcom/reader.js @@ -1963,7 +1963,16 @@ class ReaderTab extends ReaderInstance { // If this tab was unpaused, pause all others for (let reader of Zotero.Reader._readers) { if (reader === this) continue; - reader.toggleReadAloudPaused(true); + try { + reader.toggleReadAloudPaused(true); + } + catch (e) { + // Failed to pause the other reader. + // This seems to be caused by the _internalReader being a + // dead object. Not clear why, but we can log and continue; + // if the other reader is dead, it's not playing audio. + Zotero.logError(e); + } } } this._window.Zotero_Tabs.setAudioStatus(this.tabID, status);