From 6da0afdd03b67ac797bab0d0b5491a3c562ee8ff Mon Sep 17 00:00:00 2001 From: zhangbin Date: Thu, 6 Mar 2014 09:23:27 +0800 Subject: [PATCH] Solve the crash in CocoStudioComponentsTest. --- cocos/2d/CCComponentContainer.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/cocos/2d/CCComponentContainer.cpp b/cocos/2d/CCComponentContainer.cpp index 9cd093deeb..02d0f2959d 100644 --- a/cocos/2d/CCComponentContainer.cpp +++ b/cocos/2d/CCComponentContainer.cpp @@ -122,10 +122,12 @@ void ComponentContainer::visit(float delta) { if (_components != nullptr) { + CC_SAFE_RETAIN(_owner); for (auto iter = _components->begin(); iter != _components->end(); ++iter) { iter->second->update(delta); } + CC_SAFE_RELEASE(_owner); } }