mirror of
https://github.com/atom/atom.git
synced 2026-04-28 03:01:47 -04:00
Destroy all pane models when workspace view is removed
This commit is contained in:
@@ -83,3 +83,7 @@ class PaneContainer extends Model
|
||||
|
||||
itemDestroyed: (item) ->
|
||||
@emit 'item-destroyed', item
|
||||
|
||||
# Private: Called by Model superclass when destroyed
|
||||
destroyed: ->
|
||||
pane.destroy() for pane in @getPanes()
|
||||
|
||||
@@ -203,7 +203,7 @@ class Pane extends Model
|
||||
@destroyItem(item) for item in @getItems() when item isnt @activeItem
|
||||
|
||||
destroy: ->
|
||||
super unless @container?.getPanes().length is 1
|
||||
super unless @container?.isAlive() and @container?.getPanes().length is 1
|
||||
|
||||
# Private: Called by model superclass.
|
||||
destroyed: ->
|
||||
|
||||
@@ -238,8 +238,11 @@ class WorkspaceView extends View
|
||||
@on('editor:attached', attachedCallback)
|
||||
off: => @off('editor:attached', attachedCallback)
|
||||
|
||||
# Private: Called by SpacePen
|
||||
beforeRemove: ->
|
||||
@model.destroy()
|
||||
|
||||
# Private: Destroys everything.
|
||||
remove: ->
|
||||
@model.destroy()
|
||||
editorView.remove() for editorView in @getEditorViews()
|
||||
super
|
||||
|
||||
@@ -145,3 +145,7 @@ class Workspace extends Model
|
||||
onPaneItemDestroyed: (item) =>
|
||||
if uri = item.getUri?()
|
||||
@destroyedItemUris.push(uri)
|
||||
|
||||
# Private: Called by Model superclass when destroyed
|
||||
destroyed: ->
|
||||
@paneContainer.destroy()
|
||||
|
||||
Reference in New Issue
Block a user