Merge pull request #1658 from dumganhar/gles20

fixed #1576: Fixed CocosBuilderTest/AnimationTest crash, fixed some memory leaks in CCBReader.cpp.
This commit is contained in:
James Chen 2012-11-26 18:28:46 -08:00
commit 8dffd457db
4 changed files with 9 additions and 1 deletions

View File

@ -40,6 +40,9 @@ EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "WatermelonWithMe", "samples\WatermelonWithMe\proj.win32\WatermelonWithMe.vcxproj", "{BE092D9E-95AE-4F86-84CE-F4519E4F3F15}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "CocosDragonJS", "samples\CocosDragonJS\proj.win32\CocosDragonJS.vcxproj", "{68ED0B4E-2BCA-45D2-9648-CEABEBD3B9D7}"
ProjectSection(ProjectDependencies) = postProject
{21B2C324-891F-48EA-AD1A-5AE13DE12E28} = {21B2C324-891F-48EA-AD1A-5AE13DE12E28}
EndProjectSection
EndProject
Global
GlobalSection(DPCodeReviewSolutionGUID) = preSolution

View File

@ -226,6 +226,7 @@ CCNode* CCBReader::readNodeGraphFromFile(const char *pCCBFileName, CCObject *pOw
unsigned char * pBytes = CCFileUtils::sharedFileUtils()->getFileData(pPath, "rb", &size);
CCData *data = new CCData(pBytes, size);
CC_SAFE_DELETE_ARRAY(pBytes);
CCNode *ret = this->readNodeGraphFromData(data, pOwner, parentSize);

View File

@ -826,12 +826,14 @@ CCNode * CCNodeLoader::parsePropTypeCCBFile(CCNode * pNode, CCNode * pParent, CC
ccbReader->getAnimationManager()->setRootContainerSize(pParent->getContentSize());
CCData *data = new CCData(pBytes, size);
CC_SAFE_DELETE_ARRAY(pBytes);
data->retain();
ccbReader->mData = data;
ccbReader->mBytes = data->getBytes();
ccbReader->mCurrentByte = 0;
ccbReader->mCurrentBit = 0;
pCCBReader->mOwner->retain();
CC_SAFE_RETAIN(pCCBReader->mOwner);
ccbReader->mOwner = pCCBReader->mOwner;
ccbReader->mOwnerOutletNames = pCCBReader->mOwnerOutletNames;

View File

@ -121,6 +121,8 @@ void HelloCocosBuilderLayer::onAnimationsTestClicked(CCObject * pSender, cocos2d
// lblTestTitle is in the TestHeader.ccbi, which is referenced
// from each of the test scenes.
CCNode *animationsTest = ccbReader->readNodeGraphFromFile("ccb/ccb/TestAnimations.ccbi", this);
// Load node graph (TestAnimations is a sub class of CCLayer) and retrieve the ccb action manager
((AnimationsTestLayer*)animationsTest)->setAnimationManager(ccbReader->getAnimationManager());
this->mTestTitleLabelTTF->setString("TestAnimations.ccbi");