Fixed some memory leaks.

This commit is contained in:
Nick Winter 2014-05-22 12:05:30 -07:00
parent 4b88296265
commit 4c7d7fce03
3 changed files with 10 additions and 6 deletions

View file

@ -161,6 +161,7 @@ module.exports = class SpriteBoss extends CocoClass
thang = sprite.thang
delete @sprites[sprite.thang.id]
@spriteArray.splice @spriteArray.indexOf(sprite), 1
@stopListening sprite
sprite.destroy()
sprite.thang = thang # Keep around so that we know which thang the destroyed thang was for

View file

@ -62,7 +62,9 @@ module.exports = class ThangType extends CocoModel
@options = @fillOptions options
key = @spriteSheetKey(@options)
if ss = @spriteSheets[key] then return ss
return key if @building[key]
if @building[key]
@options = null
return key
@t0 = new Date().getTime()
@initBuild(options)
@addGeneralFrames() unless @options.portraitOnly
@ -159,6 +161,7 @@ module.exports = class ThangType extends CocoModel
@spriteSheets[key] = spriteSheet
delete @building[key]
@builder = null
@options = null
spriteSheet
onBuildSpriteSheetComplete: (e, data) ->