mirror of
https://github.com/godotengine/godot.git
synced 2024-11-10 06:03:09 +00:00
Merge pull request #96862 from lawnjelly/selfdestruct_correctness
Some checks failed
🔗 GHA / 📊 Static (push) Has been cancelled
🔗 GHA / 🤖 Android (push) Has been cancelled
🔗 GHA / 🍏 iOS (push) Has been cancelled
🔗 GHA / 🌐 JavaScript (push) Has been cancelled
🔗 GHA / 🐧 Linux (push) Has been cancelled
🔗 GHA / 🍎 macOS (push) Has been cancelled
🔗 GHA / ☁ Server (push) Has been cancelled
🔗 GHA / 🏁 Windows (push) Has been cancelled
Some checks failed
🔗 GHA / 📊 Static (push) Has been cancelled
🔗 GHA / 🤖 Android (push) Has been cancelled
🔗 GHA / 🍏 iOS (push) Has been cancelled
🔗 GHA / 🌐 JavaScript (push) Has been cancelled
🔗 GHA / 🐧 Linux (push) Has been cancelled
🔗 GHA / 🍎 macOS (push) Has been cancelled
🔗 GHA / ☁ Server (push) Has been cancelled
🔗 GHA / 🏁 Windows (push) Has been cancelled
[3.x] `Object::call()` prevent debug lock accessing dangling pointer
This commit is contained in:
commit
8c444fb9c9
@ -43,14 +43,17 @@
|
|||||||
#ifdef DEBUG_ENABLED
|
#ifdef DEBUG_ENABLED
|
||||||
|
|
||||||
struct _ObjectDebugLock {
|
struct _ObjectDebugLock {
|
||||||
Object *obj;
|
ObjectID obj_id;
|
||||||
|
|
||||||
_ObjectDebugLock(Object *p_obj) {
|
_ObjectDebugLock(Object *p_obj) {
|
||||||
obj = p_obj;
|
obj_id = p_obj->get_instance_id();
|
||||||
obj->_lock_index.ref();
|
p_obj->_lock_index.ref();
|
||||||
}
|
}
|
||||||
~_ObjectDebugLock() {
|
~_ObjectDebugLock() {
|
||||||
obj->_lock_index.unref();
|
Object *obj_ptr = ObjectDB::get_instance(obj_id);
|
||||||
|
if (likely(obj_ptr)) {
|
||||||
|
obj_ptr->_lock_index.unref();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user