Modifyign CCBSequence to do proper copy of objects

This commit is contained in:
Rohan Kuruvilla 2013-03-18 15:26:45 -07:00
parent 9acaaa289a
commit 035c0d7eee
2 changed files with 13 additions and 2 deletions

View File

@ -11,8 +11,15 @@ CCBSequence::CCBSequence()
, mName("") , mName("")
, mSequenceId(0) , mSequenceId(0)
, mChainedSequenceId(0) , mChainedSequenceId(0)
, mCallbackChannel(NULL)
, mSoundChannel(NULL)
{} {}
CCBSequence::~CCBSequence() {
CC_SAFE_RELEASE(mCallbackChannel);
CC_SAFE_RELEASE(mSoundChannel);
}
float CCBSequence::getDuration() float CCBSequence::getDuration()
{ {
return mDuration; return mDuration;
@ -50,7 +57,9 @@ CCBSequenceProperty* CCBSequence::getCallbackChannel()
void CCBSequence::setCallbackChannel(CCBSequenceProperty* callbackChannel) void CCBSequence::setCallbackChannel(CCBSequenceProperty* callbackChannel)
{ {
CC_SAFE_RELEASE(mCallbackChannel);
mCallbackChannel = callbackChannel; mCallbackChannel = callbackChannel;
CC_SAFE_RETAIN(mCallbackChannel);
} }
@ -61,7 +70,9 @@ CCBSequenceProperty* CCBSequence::getSoundChannel()
void CCBSequence::setSoundChannel(CCBSequenceProperty* soundChannel) void CCBSequence::setSoundChannel(CCBSequenceProperty* soundChannel)
{ {
mSoundChannel = mCallbackChannel; CC_SAFE_RELEASE(mSoundChannel);
mSoundChannel = soundChannel;
CC_SAFE_RETAIN(mSoundChannel);
} }

View File

@ -20,7 +20,7 @@ private:
public: public:
CCBSequence(); CCBSequence();
~CCBSequence();
float getDuration(); float getDuration();
void setDuration(float fDuration); void setDuration(float fDuration);