diff --git a/loader/src/utils/cocos.cpp b/loader/src/utils/cocos.cpp index d6e4c011..1aa0cb8b 100644 --- a/loader/src/utils/cocos.cpp +++ b/loader/src/utils/cocos.cpp @@ -257,6 +257,10 @@ void WeakRefPool::check(CCObject* obj) { // if this object's only reference is the WeakRefPool aka only weak // references exist to it, then release it if (obj && m_pool.contains(obj) && obj->retainCount() == 1) { + // set delegates to null because those aren't retained! + if (auto input = typeinfo_cast(obj)) { + input->m_delegate = nullptr; + } obj->release(); // log::info("nullify {}", m_pool.at(obj).get()); m_pool.at(obj)->m_obj = nullptr;