Destroy item's of last pane even if the pane itself is not destroyed

We always want to preserve at least one pane, so we don't call destroy
on the pane if it is the last pane. However, we still want to destroy
its items. This was previously relying on the view to destroy the
underlying item, which isn't as reliable as doing it in the model.
This commit is contained in:
Nathan Sobo
2014-06-09 15:04:51 +09:00
parent a2c41a2ae3
commit b1563fdfc0

View File

@@ -212,7 +212,10 @@ class Pane extends Model
@destroyItem(item) for item in @getItems() when item isnt @activeItem
destroy: ->
super unless @container?.isAlive() and @container?.getPanes().length is 1
if @container?.isAlive() and @container.getPanes().length is 1
@destroyItems()
else
super
# Called by model superclass.
destroyed: ->