From 8ab261d1b0a312c2cc151306b812a008aa6a4b5e Mon Sep 17 00:00:00 2001 From: David Rowe Date: Tue, 16 May 2017 15:52:34 +1200 Subject: [PATCH] Work around Script.clearTimeout() occasionally failing --- scripts/system/playRecordingAC.js | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/scripts/system/playRecordingAC.js b/scripts/system/playRecordingAC.js index 3eb36a2a24..d1b931bc41 100644 --- a/scripts/system/playRecordingAC.js +++ b/scripts/system/playRecordingAC.js @@ -301,6 +301,8 @@ var errorMessage; if (autoPlayTimer) { // Cancel auto-play. + // FIXME: Once in a while Script.clearTimeout() fails. + // [DEBUG] [hifi.scriptengine] [3748] [agent] stopTimer -- not in _timerFunctionMap QObject(0x0) Script.clearTimeout(autoPlayTimer); autoPlayTimer = null; } @@ -327,6 +329,11 @@ // Random delay to help reduce collisions between AC scripts. Script.setTimeout(function () { + // Guard against Script.clearTimeout() in play() not always working. + if (isPlayingRecording) { + return; + } + recording = Entity.find(); if (recording) { log("Play persisted recording " + recording.recording);