diff --git a/src/views/1_ApplicationComponent.tsx b/src/views/1_ApplicationComponent.tsx index 6e04f3b18..a45e0ea84 100644 --- a/src/views/1_ApplicationComponent.tsx +++ b/src/views/1_ApplicationComponent.tsx @@ -30,18 +30,23 @@ export default class ApplicationComponent extends React.Component<{}, State> { .on("move", () => saveWindowBounds(focusedWindow)) .on("resize", () => { saveWindowBounds(focusedWindow); - - for (const tab of this.tabs) { - tab.updateAllSessionsDimensions(); - } - }); + this.recalculateDimensions(); + }) + .webContents + .on("devtools-opened", () => this.recalculateDimensions()) + .on("devtools-closed", () => this.recalculateDimensions()); ipcRenderer.on("change-working-directory", (event: Electron.IpcRendererEvent, directory: string) => this.activeTab.activeSession().directory = directory ); window.onbeforeunload = () => { - focusedWindow.removeAllListeners(); + focusedWindow + .removeAllListeners() + .webContents + .removeAllListeners("devtools-opened") + .removeAllListeners("devtools-closed"); + this.closeAllTabs(); } } @@ -162,6 +167,12 @@ export default class ApplicationComponent extends React.Component<{}, State> { }; } + private recalculateDimensions() { + for (const tab of this.tabs) { + tab.updateAllSessionsDimensions(); + } + } + public closeSession(sessionToClose: Session) { for (const tab of this.tabs) { for (const session of tab.sessions) {