MCPcopy Create free account
hub / github.com/axmolengine/axmol / removeAllProtectedChildrenWithCleanup

Method removeAllProtectedChildrenWithCleanup

core/2d/ProtectedNode.cpp:195–225  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

193}
194
195void ProtectedNode::removeAllProtectedChildrenWithCleanup(bool cleanup)
196{
197 // not using detachChild improves speed here
198 for (auto&& child : _protectedChildren)
199 {
200 // IMPORTANT:
201 // -1st do onExit
202 // -2nd cleanup
203 if (_running)
204 {
205 child->onExitTransitionDidStart();
206 child->onExit();
207 }
208
209 if (cleanup)
210 {
211 child->cleanup();
212 }
213#if AX_ENABLE_GC_FOR_NATIVE_OBJECTS
214 auto sEngine = ScriptEngineManager::getInstance()->getScriptEngine();
215 if (sEngine)
216 {
217 sEngine->releaseScriptObject(this, child);
218 }
219#endif // AX_ENABLE_GC_FOR_NATIVE_OBJECTS
220 // set parent nil at the end
221 child->setParent(nullptr);
222 }
223
224 _protectedChildren.clear();
225}
226
227void ProtectedNode::removeProtectedChildByTag(int tag, bool cleanup)
228{

Callers

nothing calls this directly

Calls 6

getInstanceFunction · 0.85
onExitMethod · 0.45
cleanupMethod · 0.45
setParentMethod · 0.45
clearMethod · 0.45

Tested by

no test coverage detected