From 28eb490014a180ac1d5d1dc963eb1aa46e23b420 Mon Sep 17 00:00:00 2001 From: 6ea86b96 <6ea86b96@gmail.com> Date: Tue, 27 Jun 2017 19:54:25 +0700 Subject: [PATCH] Teardown old window event listeners and don't blow up when window isn't focused at boot/reload --- ui/js/main.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/ui/js/main.js b/ui/js/main.js index 94df53b32..9bef9aae1 100644 --- a/ui/js/main.js +++ b/ui/js/main.js @@ -75,7 +75,10 @@ document.addEventListener("click", event => { const application = remote.app; const dock = application.dock; -const win = remote.BrowserWindow.getFocusedWindow(); +const win = remote.getCurrentWindow(); + +// Tear down previous event listeners when reload +win.removeAllListeners(); // Clear the badge when the window is focused win.on("focus", () => { -- 2.45.2