77#include " UIModding.hpp"
88#include " nodes/CCNode.hpp"
99#include < alphalaneous.alphas_geode_utils/include/NodeModding.h>
10+ #include < alphalaneous.alphas_geode_utils/include/Fields.h>
1011#include " Utils.hpp"
1112#include " Macros.hpp"
1213#include " LateQueue.hpp"
@@ -29,16 +30,30 @@ class $modify(CCDictionary) {
2930 }
3031};
3132
32- class $modify(CCObject) {
33+ static std::unordered_map<CCObject*, uintptr_t > s_nodeVTables;
34+
35+ static bool checkNodeValidity (CCNode* node) {
36+ auto ret = *(uintptr_t *)node == s_nodeVTables[node];
37+ s_nodeVTables.erase (node);
38+ return ret;
39+ }
40+
41+ static void setNodeVTable (CCNode* node) {
42+ s_nodeVTables[node] = *(uintptr_t *)node;
43+ }
44+
45+ class $modify(HTCCObject, CCObject) {
3346
3447 CCObject* autorelease () {
3548 auto modding = UIModding::get ();
3649 if (!modding->doModify ) return CCObject::autorelease ();
3750
3851 if (MyCCNode* node = static_cast <MyCCNode*>(typeinfo_cast<CCNode*>(this ))) {
3952 if (!node->isModified ()) {
53+ setNodeVTable (node);
4054 node->retain ();
4155 LateQueue::get ()->queue (node, [modding, node] {
56+ if (!checkNodeValidity (node)) return ;
4257 std::string className = AlphaUtils::Cocos::getClassName (node, true );
4358 modding->doUICheckForType (className, node);
4459 node->setModified ();
@@ -55,10 +70,4 @@ class $modify(CCPoolManager) {
5570 LateQueue::get ()->executeQueue ();
5671 CCPoolManager::pop ();
5772 }
58-
59- void removeObject (CCObject* pObject) {
60- LateQueue::get ()->remove (pObject);
61- CCPoolManager::removeObject (pObject);
62- }
63-
6473};
0 commit comments