diff --git a/tests/cpp-tests/Classes/Sprite3DTest/Sprite3DTest.cpp b/tests/cpp-tests/Classes/Sprite3DTest/Sprite3DTest.cpp index 1f8a1403fd..ac8281b9f6 100644 --- a/tests/cpp-tests/Classes/Sprite3DTest/Sprite3DTest.cpp +++ b/tests/cpp-tests/Classes/Sprite3DTest/Sprite3DTest.cpp @@ -341,7 +341,6 @@ Effect3DOutline::Effect3DOutline() Effect3DOutline::~Effect3DOutline() { - CC_SAFE_RELEASE_NULL(_sprite); #if (CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID) Director::getInstance()->getEventDispatcher()->removeEventListener(_backToForegroundListener); #endif @@ -371,8 +370,6 @@ void Effect3DOutline::setTarget(EffectSprite3D *sprite) if(sprite != _sprite) { - CC_SAFE_RETAIN(sprite); - CC_SAFE_RELEASE_NULL(_sprite); _sprite = sprite; auto mesh = sprite->getMesh(); diff --git a/tests/cpp-tests/Classes/Sprite3DTest/Sprite3DTest.h b/tests/cpp-tests/Classes/Sprite3DTest/Sprite3DTest.h index 6695bcfc13..efb5052cc8 100644 --- a/tests/cpp-tests/Classes/Sprite3DTest/Sprite3DTest.h +++ b/tests/cpp-tests/Classes/Sprite3DTest/Sprite3DTest.h @@ -103,6 +103,7 @@ protected: Vec3 _outlineColor; float _outlineWidth; + //weak reference EffectSprite3D* _sprite; #if (CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID) EventListenerCustom* _backToForegroundListener;