From de8e5ef441858292a2c66dec03d0dba5d956b16a Mon Sep 17 00:00:00 2001 From: Martin Fournier Date: Tue, 4 Jan 2022 18:16:07 -0500 Subject: [PATCH] Fix unresponsive handler being attached many times --- electron/utils.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/electron/utils.js b/electron/utils.js index 03175b57b..17385b20e 100644 --- a/electron/utils.js +++ b/electron/utils.js @@ -48,11 +48,12 @@ function promptForReload(window) { } function attachUnresponsiveAppHandler(window) { - window.on('unresponsive', () => promptForReload(window)); + window.unresponsiveHandler = () => promptForReload(window); + window.on('unresponsive', window.unresponsiveHandler); } function detachUnresponsiveAppHandler(window) { - window.off('unresponsive', () => promptForReload(window)); + window.off('unresponsive', window.unresponsiveHandler); } function showErrorBox(title, error) {