Fixed crash

This commit is contained in:
Wenhai Lin 2015-01-21 22:46:31 +08:00
parent 342c582124
commit 5076b9f008
1 changed files with 0 additions and 4 deletions

View File

@ -122,11 +122,9 @@ void FontAtlas::purgeTexturesAtlas()
FontFreeType* fontTTf = dynamic_cast<FontFreeType*>(_font); FontFreeType* fontTTf = dynamic_cast<FontFreeType*>(_font);
if (fontTTf && _atlasTextures.size() > 1) if (fontTTf && _atlasTextures.size() > 1)
{ {
_font->retain();
auto eventDispatcher = Director::getInstance()->getEventDispatcher(); auto eventDispatcher = Director::getInstance()->getEventDispatcher();
eventDispatcher->dispatchCustomEvent(CMD_PURGE_FONTATLAS,this); eventDispatcher->dispatchCustomEvent(CMD_PURGE_FONTATLAS,this);
eventDispatcher->dispatchCustomEvent(CMD_RESET_FONTATLAS,this); eventDispatcher->dispatchCustomEvent(CMD_RESET_FONTATLAS,this);
_font->release();
} }
} }
@ -135,11 +133,9 @@ void FontAtlas::listenRendererRecreated(EventCustom *event)
FontFreeType* fontTTf = dynamic_cast<FontFreeType*>(_font); FontFreeType* fontTTf = dynamic_cast<FontFreeType*>(_font);
if (fontTTf) if (fontTTf)
{ {
_font->retain();
auto eventDispatcher = Director::getInstance()->getEventDispatcher(); auto eventDispatcher = Director::getInstance()->getEventDispatcher();
eventDispatcher->dispatchCustomEvent(CMD_PURGE_FONTATLAS,this); eventDispatcher->dispatchCustomEvent(CMD_PURGE_FONTATLAS,this);
eventDispatcher->dispatchCustomEvent(CMD_RESET_FONTATLAS,this); eventDispatcher->dispatchCustomEvent(CMD_RESET_FONTATLAS,this);
_font->release();
} }
} }