Don't save window stats after shutdown request

This commit is contained in:
Fedor Indutny 2022-06-30 14:33:58 -07:00 committed by GitHub
parent fc60a8b13d
commit d8e32d39ff
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 14 additions and 1 deletions

View File

@ -774,7 +774,9 @@ async function createWindow() {
// so if we need to recreate the window, we have the most recent settings
windowConfig = newWindowConfig;
debouncedSaveStats();
if (!windowState.requestedShutdown()) {
debouncedSaveStats();
}
}
mainWindow.on('resize', captureWindowStats);
@ -856,6 +858,7 @@ async function createWindow() {
return;
}
windowState.markRequestedShutdown();
await requestShutdown();
windowState.markReadyForShutdown();

View File

@ -20,3 +20,13 @@ export function markReadyForShutdown(): void {
export function readyForShutdown(): boolean {
return isReadyForShutdown;
}
let hasRequestedShutdown = false;
export function markRequestedShutdown(): void {
hasRequestedShutdown = true;
}
export function requestedShutdown(): boolean {
return hasRequestedShutdown;
}