mirror of
https://github.com/atom/atom.git
synced 2026-02-09 22:24:59 -05:00
Tear down editors and unsubscribe from buffers on window unload to prevent exceptions when typing after reload
This commit is contained in:
@@ -52,7 +52,7 @@ class RootView extends View
|
||||
panesViewState: @serializePanes()
|
||||
|
||||
serializePanes: () ->
|
||||
@panes.children().view().serialize()
|
||||
@panes.children().view()?.serialize()
|
||||
|
||||
deserializePanes: (panesViewState) ->
|
||||
@panes.append @deserializeView(panesViewState)
|
||||
@@ -122,3 +122,7 @@ class RootView extends View
|
||||
selected: (relativePath) => @open(relativePath)
|
||||
@append @fileFinder
|
||||
@fileFinder.editor.focus()
|
||||
|
||||
remove: ->
|
||||
editor.remove() for editor in @editors()
|
||||
super
|
||||
|
||||
@@ -24,11 +24,14 @@ windowAdditions =
|
||||
@attachRootView(path)
|
||||
@loadUserConfiguration()
|
||||
$(window).on 'close', => @close()
|
||||
$(window).on 'beforeunload', => @saveRootViewState()
|
||||
$(window).on 'beforeunload', =>
|
||||
@shutdown()
|
||||
false
|
||||
$(window).focus()
|
||||
atom.windowOpened this
|
||||
|
||||
shutdown: ->
|
||||
@saveRootViewState()
|
||||
@rootView.remove()
|
||||
$(window).unbind('focus')
|
||||
$(window).unbind('blur')
|
||||
@@ -38,6 +41,7 @@ windowAdditions =
|
||||
attachRootView: (pathToOpen) ->
|
||||
rootViewState = atom.rootViewStates[$windowNumber]
|
||||
@rootView = if rootViewState
|
||||
console.log "RootView deserialize", rootViewState
|
||||
RootView.deserialize(rootViewState)
|
||||
else
|
||||
new RootView {pathToOpen}
|
||||
|
||||
Reference in New Issue
Block a user