From 37d7e1e8c66792226a6976d85d8f417a49b6f605 Mon Sep 17 00:00:00 2001 From: Oliver Schwendener Date: Thu, 19 Jul 2018 12:10:38 +0200 Subject: [PATCH] Destroy existing trayIcon when creating new one --- src/ts/main.ts | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/ts/main.ts b/src/ts/main.ts index a8ede0ac6..7a9c3afc3 100644 --- a/src/ts/main.ts +++ b/src/ts/main.ts @@ -84,6 +84,10 @@ function createMainWindow(): void { } function createTrayIcon(): void { + if (trayIcon !== undefined && !trayIcon.isDestroyed()) { + trayIcon.destroy(); + } + trayIcon = new Tray(Injector.getTrayIconPath(platform(), path.join(__dirname, "../"))); trayIcon.setToolTip(UeliHelpers.productName); trayIcon.setContextMenu(Menu.buildFromTemplate([