Skip to content

Commit e0f240b

Browse files
committed
Revert to validity check
1 parent 1200e9b commit e0f240b

File tree

3 files changed

+20
-8
lines changed

3 files changed

+20
-8
lines changed

changelog.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
# 2.0.10
2+
- Actually fix a crash
3+
14
# 2.0.9
25
- Fix a crash
36

mod.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
"mac": "2.2074",
77
"ios": "2.2074"
88
},
9-
"version": "v2.0.9",
9+
"version": "v2.0.10",
1010
"id": "alphalaneous.happy_textures",
1111
"name": "Happy Textures :3",
1212
"developer": "Alphalaneous",

src/NodeModding.hpp

Lines changed: 16 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
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

Comments
 (0)