Skip to content
This repository has been archived by the owner on Dec 11, 2019. It is now read-only.

Commit

Permalink
last window closed should be immutable
Browse files Browse the repository at this point in the history
Auditors: @bsclifton

Fix #10423
  • Loading branch information
bbondy committed Aug 11, 2017
1 parent 07c6cd9 commit a6e88b5
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions app/sessionStoreShutdown.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ let sessionStateStoreCompleteCallback
let saveAppStateTimeout
let windowCloseRequestId
let shuttingDown
let lastWindowThatWasClosedState
let immutableLastWindowClosedState
let isAllWindowsClosed
let sessionStateSaveInterval
// Stores the last window state for each requested window in case a hung window happens,
Expand All @@ -42,7 +42,7 @@ const reset = () => {
saveAppStateTimeout = null
windowCloseRequestId = 0
shuttingDown = false
lastWindowThatWasClosedState = undefined
immutableLastWindowClosedState = undefined
isAllWindowsClosed = false
sessionStateSaveInterval = null
immutableWindowStateCache = Immutable.Map()
Expand Down Expand Up @@ -135,8 +135,8 @@ const initiateSessionStateSave = () => {
immutablePerWindowState = Immutable.List()

// quit triggered by window-all-closed should save last window state
if (isAllWindowsClosed && lastWindowThatWasClosedState) {
immutablePerWindowState = immutablePerWindowState.push(lastWindowThatWasClosedState)
if (isAllWindowsClosed && immutableLastWindowClosedState) {
immutablePerWindowState = immutablePerWindowState.push(immutableLastWindowClosedState)
saveAppState(true)
} else if (BrowserWindow.getAllWindows().length > 0) {
++windowCloseRequestId
Expand Down Expand Up @@ -213,15 +213,15 @@ ipcMain.on(messages.RESPONSE_WINDOW_STATE, (evt, data, id) => {

ipcMain.on(messages.LAST_WINDOW_STATE, (evt, data) => {
if (data) {
lastWindowThatWasClosedState = data
immutableLastWindowClosedState = Immutable.fromJS(data)
}
})

process.on(messages.UNDO_CLOSED_WINDOW, () => {
if (lastWindowThatWasClosedState) {
sessionStore.cleanPerWindowData(lastWindowThatWasClosedState)
appActions.newWindow(undefined, undefined, lastWindowThatWasClosedState)
lastWindowThatWasClosedState = undefined
if (immutableLastWindowClosedState) {
sessionStore.cleanPerWindowData(immutableLastWindowClosedState)
appActions.newWindow(undefined, undefined, immutableLastWindowClosedState)
immutableLastWindowClosedState = undefined
}
})

Expand Down

0 comments on commit a6e88b5

Please sign in to comment.