diff --git a/core/object.h b/core/object.h index e8a6178052c..603f2eadb6c 100644 --- a/core/object.h +++ b/core/object.h @@ -779,8 +779,13 @@ public: static int get_object_count(); _FORCE_INLINE_ static bool instance_validate(Object *p_ptr) { + rw_lock->read_lock(); - return instance_checks.has(p_ptr); + bool exists = instance_checks.has(p_ptr); + + rw_lock->read_unlock(); + + return exists; } };