fixed #16737: NodeTest (stress test #2: no leaks) is broken. (#16741)

'clone' method must invoke the inner object's clone method rather than its raw pointer.
This commit is contained in:
James Chen 2016-10-26 15:54:01 +08:00 committed by minggo
parent 5b8919829c
commit 0a31c7de3a
2 changed files with 12 additions and 12 deletions

View File

@ -148,7 +148,7 @@ CLASSNAME* CLASSNAME::create(cocos2d::ActionInterval *action) \
} \ } \
CLASSNAME* CLASSNAME::clone() const \ CLASSNAME* CLASSNAME::clone() const \
{ \ { \
if(_inner) return CLASSNAME::create(_inner); \ if(_inner) return CLASSNAME::create(_inner->clone()); \
return nullptr; \ return nullptr; \
} \ } \
void CLASSNAME::update(float time) { \ void CLASSNAME::update(float time) { \
@ -205,7 +205,7 @@ CLASSNAME* CLASSNAME::create(cocos2d::ActionInterval *action, float rate) \
} \ } \
CLASSNAME* CLASSNAME::clone() const \ CLASSNAME* CLASSNAME::clone() const \
{ \ { \
if(_inner) return CLASSNAME::create(_inner, _rate); \ if(_inner) return CLASSNAME::create(_inner->clone(), _rate); \
return nullptr; \ return nullptr; \
} \ } \
void CLASSNAME::update(float time) { \ void CLASSNAME::update(float time) { \
@ -254,7 +254,7 @@ CLASSNAME* CLASSNAME::create(cocos2d::ActionInterval *action, float period /* =
} \ } \
CLASSNAME* CLASSNAME::clone() const \ CLASSNAME* CLASSNAME::clone() const \
{ \ { \
if(_inner) return CLASSNAME::create(_inner, _period); \ if(_inner) return CLASSNAME::create(_inner->clone(), _period); \
return nullptr; \ return nullptr; \
} \ } \
void CLASSNAME::update(float time) { \ void CLASSNAME::update(float time) { \

View File

@ -130,9 +130,9 @@ CC_CONSTRUCTOR_ACCESS: \
CLASSNAME() { } \ CLASSNAME() { } \
public: \ public: \
static CLASSNAME* create(ActionInterval* action); \ static CLASSNAME* create(ActionInterval* action); \
CLASSNAME* clone() const override; \ virtual CLASSNAME* clone() const override; \
void update(float time) override; \ virtual void update(float time) override; \
ActionEase* reverse() const override; \ virtual ActionEase* reverse() const override; \
private: \ private: \
CC_DISALLOW_COPY_AND_ASSIGN(CLASSNAME); \ CC_DISALLOW_COPY_AND_ASSIGN(CLASSNAME); \
}; };
@ -379,9 +379,9 @@ CC_CONSTRUCTOR_ACCESS: \
CLASSNAME() { } \ CLASSNAME() { } \
public: \ public: \
static CLASSNAME* create(ActionInterval* action, float rate); \ static CLASSNAME* create(ActionInterval* action, float rate); \
CLASSNAME* clone() const override; \ virtual CLASSNAME* clone() const override; \
void update(float time) override; \ virtual void update(float time) override; \
EaseRateAction* reverse() const override; \ virtual EaseRateAction* reverse() const override; \
private: \ private: \
CC_DISALLOW_COPY_AND_ASSIGN(CLASSNAME); \ CC_DISALLOW_COPY_AND_ASSIGN(CLASSNAME); \
}; };
@ -466,9 +466,9 @@ CC_CONSTRUCTOR_ACCESS: \
CLASSNAME() { } \ CLASSNAME() { } \
public: \ public: \
static CLASSNAME* create(ActionInterval* action, float rate = 0.3f); \ static CLASSNAME* create(ActionInterval* action, float rate = 0.3f); \
CLASSNAME* clone() const override; \ virtual CLASSNAME* clone() const override; \
void update(float time) override; \ virtual void update(float time) override; \
EaseElastic* reverse() const override; \ virtual EaseElastic* reverse() const override; \
private: \ private: \
CC_DISALLOW_COPY_AND_ASSIGN(CLASSNAME); \ CC_DISALLOW_COPY_AND_ASSIGN(CLASSNAME); \
}; };