Unsubscribe if editor has no session

This commit is contained in:
Kevin Sawicki
2013-04-07 14:52:20 -07:00
parent 049a2b3884
commit 4636e9ca40

View File

@@ -18,7 +18,7 @@ class SpellCheckView extends View
@subscribeToBuffer()
subscribeToBuffer: ->
unsubscribeFromBuffer: ->
@destroyViews()
@task?.abort()
@@ -26,6 +26,9 @@ class SpellCheckView extends View
@buffer.off '.spell-check'
@buffer = null
subscribeToBuffer: ->
@unsubscribeFromBuffer()
if @spellCheckCurrentGrammar()
@buffer = @editor.getBuffer()
@buffer.on 'contents-modified.spell-check', => @updateMisspellings()
@@ -47,6 +50,10 @@ class SpellCheckView extends View
@append(view)
updateMisspellings: ->
unless @editor.activeEditSession?
@unsubscribeFromBuffer()
return
@task?.abort()
callback = (misspellings) =>