Fixed one more leak.

This commit is contained in:
Nick Winter 2014-02-12 13:43:17 -08:00
parent cdf268ce4f
commit b7be08ac19

View file

@ -74,14 +74,15 @@ module.exports = class SpellView extends View
$(@ace.container).find('.ace_gutter').on 'click', '.ace_error, .ace_warning, .ace_info', @onAnnotationClick $(@ace.container).find('.ace_gutter').on 'click', '.ace_error, .ace_warning, .ace_info', @onAnnotationClick
createACEShortcuts: -> createACEShortcuts: ->
@aceCommands = [] @aceCommands = aceCommands = []
addCommand = (c) => ace = @ace
@ace.commands.addCommand c addCommand = (c) ->
@aceCommands.push c.name ace.commands.addCommand c
aceCommands.push c.name
addCommand addCommand
name: 'run-code' name: 'run-code'
bindKey: {win: 'Shift-Enter|Ctrl-Enter|Ctrl-S', mac: 'Shift-Enter|Command-Enter|Ctrl-Enter|Command-S|Ctrl-S'} bindKey: {win: 'Shift-Enter|Ctrl-Enter|Ctrl-S', mac: 'Shift-Enter|Command-Enter|Ctrl-Enter|Command-S|Ctrl-S'}
exec: (e) => @recompile() exec: -> Backbone.Mediator.publish 'tome:manual-cast', {}
addCommand addCommand
name: 'toggle-playing' name: 'toggle-playing'
bindKey: {win: 'Ctrl-P', mac: 'Command-P|Ctrl-P'} bindKey: {win: 'Ctrl-P', mac: 'Command-P|Ctrl-P'}
@ -219,7 +220,7 @@ module.exports = class SpellView extends View
recompileIfNeeded: => recompileIfNeeded: =>
@recompile() if @recompileNeeded @recompile() if @recompileNeeded
recompile: (cast=true) => recompile: (cast=true) ->
@setRecompileNeeded false @setRecompileNeeded false
return if @spell.source is @getSource() return if @spell.source is @getSource()
@spell.transpile @getSource() @spell.transpile @getSource()
@ -519,5 +520,5 @@ module.exports = class SpellView extends View
@debugView?.destroy() @debugView?.destroy()
@spell = null @spell = null
@session.off 'change:multiplayer', @onMultiplayerChanged, @ @session.off 'change:multiplayer', @onMultiplayerChanged, @
for fat in ['notifySpellChanged', 'notifyEditingEnded', 'notifyEditingBegan', 'onFirepadLoaded', 'onLoaded', 'recompile', 'toggleBackground', 'setRecompileNeeded', 'onCursorActivity', 'highlightCurrentLine', 'updateAether', 'onCodeChangeMetaHandler', 'recompileIfNeeded', 'currentAutocastHandler'] for fat in ['notifySpellChanged', 'notifyEditingEnded', 'notifyEditingBegan', 'onFirepadLoaded', 'onLoaded', 'toggleBackground', 'setRecompileNeeded', 'onCursorActivity', 'highlightCurrentLine', 'updateAether', 'onCodeChangeMetaHandler', 'recompileIfNeeded', 'currentAutocastHandler']
@[fat] = null @[fat] = null