Merge pull request #2435 from minggo/master

fix memory leak in FontTest
This commit is contained in:
minggo 2013-04-23 23:53:13 -07:00
commit c0582d9d40
1 changed files with 10 additions and 3 deletions

View File

@ -6,6 +6,10 @@ enum {
kTagLabel2,
kTagLabel3,
kTagLabel4,
kTagColor1,
kTagColor2,
kTagColor3,
};
static int fontIdx = 0;
@ -99,6 +103,9 @@ void FontTest::showFont(const char *pFont)
removeChildByTag(kTagLabel2, true);
removeChildByTag(kTagLabel3, true);
removeChildByTag(kTagLabel4, true);
removeChildByTag(kTagColor1, true);
removeChildByTag(kTagColor2, true);
removeChildByTag(kTagColor3, true);
CCLabelTTF *top = CCLabelTTF::create(pFont, pFont, 24);
CCLabelTTF *left = CCLabelTTF::create("alignment left", pFont, fontSize,
@ -133,11 +140,11 @@ void FontTest::showFont(const char *pFont)
right->setPosition(ccp(blockSize.width*2, s.height/2));
rightColor->setPosition(right->getPosition());
this->addChild(leftColor, -1);
this->addChild(leftColor, -1, kTagColor1);
this->addChild(left, 0, kTagLabel1);
this->addChild(rightColor, -1);
this->addChild(rightColor, -1, kTagColor2);
this->addChild(right, 0, kTagLabel2);
this->addChild(centerColor, -1);
this->addChild(centerColor, -1, kTagColor3);
this->addChild(center, 0, kTagLabel3);
this->addChild(top, 0, kTagLabel4);
}