From 13efc1bb062a64d513618b136bfd3d888adb2ec5 Mon Sep 17 00:00:00 2001 From: santouits Date: Sun, 28 Jul 2019 23:19:44 +0300 Subject: Hopefully fix the random crashes with threads --- core/object.h | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'core/object.h') diff --git a/core/object.h b/core/object.h index dce1cc74ae..15c3ab94c5 100644 --- a/core/object.h +++ b/core/object.h @@ -794,8 +794,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; } }; -- cgit v1.2.3