diff --git a/cocos2dx/platform/win32/CCImage.cpp b/cocos2dx/platform/win32/CCImage.cpp index af85258182..f5011f7516 100644 --- a/cocos2dx/platform/win32/CCImage.cpp +++ b/cocos2dx/platform/win32/CCImage.cpp @@ -375,7 +375,6 @@ bool CCImage::initWithString( int nSize/* = 0*/) { bool bRet = false; - unsigned char * pImageData = 0; do { CC_BREAK_IF(! pText); @@ -391,8 +390,8 @@ bool CCImage::initWithString( SIZE size = {nWidth, nHeight}; CC_BREAK_IF(! dc.drawText(pText, size, eAlignMask)); - pImageData = new unsigned char[size.cx * size.cy * 4]; - CC_BREAK_IF(! pImageData); + m_pData = new unsigned char[size.cx * size.cy * 4]; + CC_BREAK_IF(! m_pData); struct { @@ -407,8 +406,6 @@ bool CCImage::initWithString( m_nHeight = (short)size.cy; m_bHasAlpha = true; m_bPreMulti = false; - m_pData = pImageData; - pImageData = 0; m_nBitsPerComponent = 8; // copy pixed data bi.bmiHeader.biHeight = (bi.bmiHeader.biHeight > 0) diff --git a/cocos2dx/textures/CCTexture2D.cpp b/cocos2dx/textures/CCTexture2D.cpp index 0e17c104d7..3824f0710a 100644 --- a/cocos2dx/textures/CCTexture2D.cpp +++ b/cocos2dx/textures/CCTexture2D.cpp @@ -448,16 +448,16 @@ bool CCTexture2D::initWithString(const char *text, const char *fontName, float f return false; } + CCImage* pImage = new CCImage(); do { - CCImage* pImage = new CCImage(); CC_BREAK_IF(NULL == pImage); bRet = pImage->initWithString(text, (int)dimensions.width, (int)dimensions.height, eAlign, fontName, (int)fontSize); CC_BREAK_IF(!bRet); bRet = initWithImage(pImage); - CC_SAFE_RELEASE(pImage); } while (0); - + CC_SAFE_RELEASE(pImage); + return bRet; } diff --git a/extensions/CCBReader/CCBReader.cpp b/extensions/CCBReader/CCBReader.cpp index 8eca651374..51726ca4e6 100644 --- a/extensions/CCBReader/CCBReader.cpp +++ b/extensions/CCBReader/CCBReader.cpp @@ -877,7 +877,8 @@ bool CCBReader::readSoundKeyframesForSeq(CCBSequence* seq) { if(!numKeyframes) return true; CCBSequenceProperty* channel = new CCBSequenceProperty(); - + channel->autorelease(); + for(int i = 0; i < numKeyframes; ++i) { float time = readFloat(); @@ -896,8 +897,8 @@ bool CCBReader::readSoundKeyframesForSeq(CCBSequence* seq) { CCBKeyframe* keyframe = new CCBKeyframe(); keyframe->setTime(time); keyframe->setValue(value); - channel->getKeyframes()->addObject(keyframe); + keyframe->release(); } seq->setSoundChannel(channel); diff --git a/samples/Cpp/TestCpp/Classes/ExtensionsTest/CocosBuilderTest/TimelineCallbackTest/TimelineCallbackTestLayer.cpp b/samples/Cpp/TestCpp/Classes/ExtensionsTest/CocosBuilderTest/TimelineCallbackTest/TimelineCallbackTestLayer.cpp index f9ca3705ed..5d7ff0269b 100644 --- a/samples/Cpp/TestCpp/Classes/ExtensionsTest/CocosBuilderTest/TimelineCallbackTest/TimelineCallbackTestLayer.cpp +++ b/samples/Cpp/TestCpp/Classes/ExtensionsTest/CocosBuilderTest/TimelineCallbackTest/TimelineCallbackTestLayer.cpp @@ -1,4 +1,5 @@ #include "TimelineCallbackTestLayer.h" +#include "SimpleAudioEngine.h" USING_NS_CC; USING_NS_CC_EXT; @@ -10,6 +11,7 @@ TimelineCallbackTestLayer::TimelineCallbackTestLayer() TimelineCallbackTestLayer::~TimelineCallbackTestLayer() { CC_SAFE_RELEASE(_helloLabel); + CocosDenshion::SimpleAudioEngine::end(); } SEL_MenuHandler TimelineCallbackTestLayer::onResolveCCBCCMenuItemSelector(CCObject * pTarget, const char * pSelectorName) { diff --git a/samples/Cpp/TestCpp/Classes/LabelTest/LabelTest.cpp b/samples/Cpp/TestCpp/Classes/LabelTest/LabelTest.cpp index e9d4c87db6..29fb6c921c 100644 --- a/samples/Cpp/TestCpp/Classes/LabelTest/LabelTest.cpp +++ b/samples/Cpp/TestCpp/Classes/LabelTest/LabelTest.cpp @@ -1004,7 +1004,9 @@ void LabelTTFTest::updateAlignment() { m_plabel->removeFromParentAndCleanup(true); } - + + CC_SAFE_RELEASE(m_plabel); + m_plabel = CCLabelTTF::create(this->getCurrentAlignment(), "Marker Felt", 32, blockSize, m_eHorizAlign, m_eVertAlign); m_plabel->retain();