mirror of
https://github.com/bitwarden/browser
synced 2025-12-29 22:53:44 +00:00
add a dispose method for cleanup of ipc handlers
This commit is contained in:
@@ -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();
|
||||
|
||||
@@ -312,7 +312,7 @@ export class Main {
|
||||
);
|
||||
|
||||
app.on("will-quit", () => {
|
||||
this.mainDesktopAutotypeService.disableAutotype();
|
||||
this.mainDesktopAutotypeService.dispose();
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user