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(); }); }