Skip to content

Commit

Permalink
fix(#28): uncaught exception on macOS when app was closed and reopened
Browse files Browse the repository at this point in the history
  • Loading branch information
notmedia committed Dec 6, 2022
1 parent d862609 commit fc54fb5
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/main/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import {
registerGrpcWebClientSubscribers,
registerOSSubscribers,
registerProtobufSubscribers,
unregisterDialogSubscribers,
} from './ipc';

// This allows TypeScript to pick up the magic constant that's auto-generated by Forge's Webpack
Expand Down Expand Up @@ -60,6 +61,8 @@ app.on('ready', createWindow);
// for applications and their menu bar to stay active until the user quits
// explicitly with Cmd + Q.
app.on('window-all-closed', () => {
unregisterDialogSubscribers();

if (process.platform !== 'darwin') {
app.quit();
}
Expand Down
4 changes: 4 additions & 0 deletions src/main/ipc/dialog/subscribers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,7 @@ export const registerDialogSubscribers = (mainWindow: BrowserWindow) => {
return [];
});
};

export const unregisterDialogSubscribers = () => {
ipcMain.removeHandler(DialogChannel.OPEN);
};

0 comments on commit fc54fb5

Please sign in to comment.