fix weakref on CCTextInputNode

This commit is contained in:
HJfod 2023-04-10 12:59:23 +03:00
parent bc840ecb98
commit 2ce5680a6a

View file

@ -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<CCTextInputNode*>(obj)) {
input->m_delegate = nullptr;
}
obj->release();
// log::info("nullify {}", m_pool.at(obj).get());
m_pool.at(obj)->m_obj = nullptr;