From 3496862ed91a20d10ff79b5416f5313965be356f Mon Sep 17 00:00:00 2001 From: yflory Date: Tue, 23 Feb 2021 13:57:15 +0100 Subject: [PATCH] Fix improved locks --- www/common/onlyoffice/inner.js | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/www/common/onlyoffice/inner.js b/www/common/onlyoffice/inner.js index 834aa7623..9ffadea3c 100644 --- a/www/common/onlyoffice/inner.js +++ b/www/common/onlyoffice/inner.js @@ -989,7 +989,12 @@ define([ deleteOfflineLocks(); // Prepare callback if (cpNfInner) { - APP.waitLock = Util.mkEvent(true); + var waitLock = APP.waitLock = Util.mkEvent(true); + setTimeout(function () { + // Make sure the waitLock is never stuck + waitLock.fire(); + if (waitLock === APP.waitLock) { delete APP.waitLock; } + }, 5000); var onPatchSent = function (again) { if (!again) { cpNfInner.offPatchSent(onPatchSent); } // Answer to our onlyoffice @@ -1005,8 +1010,8 @@ define([ type: "getLock", locks: getLock() }); - APP.waitLock.fire(); - delete APP.waitLock; + waitLock.fire(); + if (waitLock === APP.waitLock) { delete APP.waitLock; } } else { if (!isLockedModal.modal) { isLockedModal.modal = UI.openCustomModal(isLockedModal.content);