Guard against focusing a destroyed pane

This commit is contained in:
Nathan Sobo
2015-11-12 17:34:48 -07:00
parent c52da33332
commit fa66048d71
2 changed files with 7 additions and 1 deletions

View File

@@ -751,6 +751,12 @@ describe "Pane", ->
pane2.destroy()
expect(container.root).toBe pane1
describe "::focus()", ->
it "doesn't blow up if the pane has been destroyed", ->
pane = new Pane(paneParams())
pane.destroy()
pane.focus()
describe "serialization", ->
pane = null

View File

@@ -248,7 +248,7 @@ class Pane extends Model
# Called by the view layer to indicate that the pane has gained focus.
focus: ->
@focused = true
@activate() unless @isActive()
@activate() unless @isActive() or @isDestroyed()
# Called by the view layer to indicate that the pane has lost focus.
blur: ->