diff --git a/ivette/src/dome/main/dome.ts b/ivette/src/dome/main/dome.ts index 993f45c5bdd104cb3bbe59bad0220b97631643ca..fde22418299c5565e527a09fd89da3ff7a1edec8 100644 --- a/ivette/src/dome/main/dome.ts +++ b/ivette/src/dome/main/dome.ts @@ -483,18 +483,15 @@ function createBrowserWindow( theWindow.off('close', closeHandler); // Do not close the window yet event.preventDefault(); - + // Save state handle.frame = theWindow.getBounds(); handle.devtools = webContents.isDevToolsOpened(); - webContents.send('dome.ipc.closing'); + // Start closing process + webContents.send('dome.ipc.closing', wid); }; theWindow.on('close', closeHandler); - ipcMain.on('dome.ipc.closing.done', () => { - theWindow.close(); - }); - // Keep track of frame positions (in DEVEL) if (DEVEL) { const saveFrame = _.debounce(() => { @@ -509,6 +506,11 @@ function createBrowserWindow( return theWindow; } +ipcMain.on('dome.ipc.closing.done', (_event, wid:number) => { + const handle = WindowHandles.get(wid); + if (handle !== undefined) handle.window.close(); +}); + // -------------------------------------------------------------------------- // --- Application Window(s) & Command Line // -------------------------------------------------------------------------- diff --git a/ivette/src/dome/renderer/dome.tsx b/ivette/src/dome/renderer/dome.tsx index d05bbd025647811411d424b51848735991eb3992..07d8d0e2c23938c88e33202e92121b1f5ab03dcb 100644 --- a/ivette/src/dome/renderer/dome.tsx +++ b/ivette/src/dome/renderer/dome.tsx @@ -251,9 +251,9 @@ export const globalSettings = new Event(Settings.global); // --- Closing // -------------------------------------------------------------------------- -ipcRenderer.on('dome.ipc.closing', async () => { +ipcRenderer.on('dome.ipc.closing', async (_event, wid: number) => { await System.doExit(); - ipcRenderer.send('dome.ipc.closing.done'); + ipcRenderer.send('dome.ipc.closing.done', wid); }); /** Register a callback to be executed when the window is closing. */