| 193 | } |
| 194 | |
| 195 | void 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 | |
| 227 | void ProtectedNode::removeProtectedChildByTag(int tag, bool cleanup) |
| 228 | { |
nothing calls this directly
no test coverage detected