fix memory leak in handletouchpriority

This commit is contained in:
Cvolton 2024-03-25 23:24:20 +01:00
parent 912aa23833
commit c8d1e88a97
No known key found for this signature in database

View file

@ -500,15 +500,13 @@ void GEODE_DLL geode::cocos::handleTouchPriorityWith(cocos2d::CCNode* node, int
}
}
void GEODE_DLL geode::cocos::handleTouchPriority(cocos2d::CCNode* node, bool force) {
node->retain();
Loader::get()->queueInMainThread([node, force]() {
if (auto delegate = typeinfo_cast<CCTouchDelegate*>(node)) {
Loader::get()->queueInMainThread([node = Ref(node), force]() {
if (auto delegate = typeinfo_cast<CCTouchDelegate*>(*node)) {
if (auto handler = CCTouchDispatcher::get()->findHandler(delegate)) {
return handleTouchPriorityWith(node, handler->m_nPriority - 1, force);
}
}
handleTouchPriorityWith(node, 0, force);
node->release();
});
}