diff options
author | Pedro J. Estébanez <pedrojrulez@gmail.com> | 2024-09-11 14:54:09 +0200 |
---|---|---|
committer | Rémi Verschelde <rverschelde@gmail.com> | 2024-09-17 08:57:45 +0200 |
commit | 018f8be3d549a70173f7d9f17a813b7c51a3055b (patch) | |
tree | acedfdb79850ca995a2ff96accbe438bcf61adee /core | |
parent | d92f9017c67ae93a51ef6796520ecc8e12d09d2e (diff) | |
download | redot-engine-018f8be3d549a70173f7d9f17a813b7c51a3055b.tar.gz |
Object: Let debug lock handle callee destruction within call chain gracefully
Co-authored-by: lawnjelly <lawnjelly@gmail.com>
(cherry picked from commit 10e2318bdeccdc33f95ebdb2c7683b816dda67fb)
Diffstat (limited to 'core')
-rw-r--r-- | core/object/object.cpp | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/core/object/object.cpp b/core/object/object.cpp index bf24c3a792..3f5378b7f6 100644 --- a/core/object/object.cpp +++ b/core/object/object.cpp @@ -45,14 +45,17 @@ #ifdef DEBUG_ENABLED struct _ObjectDebugLock { - Object *obj; + ObjectID obj_id; _ObjectDebugLock(Object *p_obj) { - obj = p_obj; - obj->_lock_index.ref(); + obj_id = p_obj->get_instance_id(); + p_obj->_lock_index.ref(); } ~_ObjectDebugLock() { - obj->_lock_index.unref(); + Object *obj_ptr = ObjectDB::get_instance(obj_id); + if (likely(obj_ptr)) { + obj_ptr->_lock_index.unref(); + } } }; |