retain node in handleTouchPriority

This commit is contained in:
Cvolton 2024-03-24 22:35:17 +01:00
parent 7f509e5297
commit 2d13d4f84f
No known key found for this signature in database

View file

@ -500,6 +500,7 @@ void GEODE_DLL geode::cocos::handleTouchPriorityWith(cocos2d::CCNode* node, int
} }
} }
void GEODE_DLL geode::cocos::handleTouchPriority(cocos2d::CCNode* node, bool force) { void GEODE_DLL geode::cocos::handleTouchPriority(cocos2d::CCNode* node, bool force) {
node->retain();
Loader::get()->queueInMainThread([node, force]() { Loader::get()->queueInMainThread([node, force]() {
if (auto delegate = typeinfo_cast<CCTouchDelegate*>(node)) { if (auto delegate = typeinfo_cast<CCTouchDelegate*>(node)) {
if (auto handler = CCTouchDispatcher::get()->findHandler(delegate)) { if (auto handler = CCTouchDispatcher::get()->findHandler(delegate)) {
@ -507,6 +508,7 @@ void GEODE_DLL geode::cocos::handleTouchPriority(cocos2d::CCNode* node, bool for
} }
} }
handleTouchPriorityWith(node, 0, force); handleTouchPriorityWith(node, 0, force);
node->release();
}); });
} }