diff options
author | Pedro J. Estébanez <pedrojrulez@gmail.com> | 2024-04-18 17:42:55 +0200 |
---|---|---|
committer | Pedro J. Estébanez <pedrojrulez@gmail.com> | 2024-05-08 17:41:40 +0200 |
commit | b834037841fef2603b23133e67340f470e46cf0f (patch) | |
tree | 4c0b244cc34dbfb083bd41e651a8caa9833de8fd /core | |
parent | 755c7494c2d10e5e81a3105a2e6bb5bc29970cc1 (diff) | |
download | redot-engine-b834037841fef2603b23133e67340f470e46cf0f.tar.gz |
Object: Add missing lock
Diffstat (limited to 'core')
-rw-r--r-- | core/object/object.cpp | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/core/object/object.cpp b/core/object/object.cpp index ab89f96a0d..dfc8e2a29a 100644 --- a/core/object/object.cpp +++ b/core/object/object.cpp @@ -2307,9 +2307,9 @@ void ObjectDB::setup() { } void ObjectDB::cleanup() { - if (slot_count > 0) { - spin_lock.lock(); + spin_lock.lock(); + if (slot_count > 0) { WARN_PRINT("ObjectDB instances leaked at exit (run with --verbose for details)."); if (OS::get_singleton()->is_stdout_verbose()) { // Ensure calling the native classes because if a leaked instance has a script @@ -2340,10 +2340,11 @@ void ObjectDB::cleanup() { } print_line("Hint: Leaked instances typically happen when nodes are removed from the scene tree (with `remove_child()`) but not freed (with `free()` or `queue_free()`)."); } - spin_lock.unlock(); } if (object_slots) { memfree(object_slots); } + + spin_lock.unlock(); } |