From 27d8f3f4f2177611d7b85ef4f0d1f631129d7d85 Mon Sep 17 00:00:00 2001 From: neuronull <9162534+neuronull@users.noreply.github.com> Date: Mon, 3 Nov 2025 15:31:12 -0700 Subject: [PATCH] add a dispose method for cleanup of ipc handlers --- .../autofill/main/main-desktop-autotype.service.ts | 11 +++++++++++ apps/desktop/src/main.ts | 2 +- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/apps/desktop/src/autofill/main/main-desktop-autotype.service.ts b/apps/desktop/src/autofill/main/main-desktop-autotype.service.ts index 59d1cb5a030..85c447db052 100644 --- a/apps/desktop/src/autofill/main/main-desktop-autotype.service.ts +++ b/apps/desktop/src/autofill/main/main-desktop-autotype.service.ts @@ -79,6 +79,17 @@ export class MainDesktopAutotypeService { } } + dispose() { + ipcMain.removeHandler(AUTOTYPE_IPC_CHANNELS.INIT); + ipcMain.removeHandler(AUTOTYPE_IPC_CHANNELS.INITIALIZED); + ipcMain.removeAllListeners(AUTOTYPE_IPC_CHANNELS.TOGGLE); + ipcMain.removeAllListeners(AUTOTYPE_IPC_CHANNELS.CONFIGURE); + ipcMain.removeAllListeners(AUTOTYPE_IPC_CHANNELS.EXECUTE); + + // Also unregister the global shortcut + this.disableAutotype(); + } + // Register the current keyboard shortcut if not already registered. private enableAutotype() { const formattedKeyboardShortcut = this.autotypeKeyboardShortcut.getElectronFormat(); diff --git a/apps/desktop/src/main.ts b/apps/desktop/src/main.ts index 378441e4b32..4734288f3c1 100644 --- a/apps/desktop/src/main.ts +++ b/apps/desktop/src/main.ts @@ -312,7 +312,7 @@ export class Main { ); app.on("will-quit", () => { - this.mainDesktopAutotypeService.disableAutotype(); + this.mainDesktopAutotypeService.dispose(); }); }