Fix event listener cleanup in destructor

Event listeners should always be removed at destroy (move out of
if-block)
This commit is contained in:
Alex Peak 2015-06-30 18:59:33 -07:00
parent 7cea464a11
commit 5328996a18
1 changed files with 2 additions and 3 deletions

View File

@ -294,10 +294,9 @@ Label::~Label()
if (_fontAtlas)
{
FontAtlasCache::releaseFontAtlas(_fontAtlas);
_eventDispatcher->removeEventListener(_purgeTextureListener);
_eventDispatcher->removeEventListener(_resetTextureListener);
}
_eventDispatcher->removeEventListener(_purgeTextureListener);
_eventDispatcher->removeEventListener(_resetTextureListener);
CC_SAFE_RELEASE_NULL(_reusedLetter);
}