summaryrefslogtreecommitdiff
path: root/core/object.cpp
diff options
context:
space:
mode:
authorRĂ©mi Verschelde <rverschelde@gmail.com>2020-06-09 14:10:05 +0200
committerGitHub <noreply@github.com>2020-06-09 14:10:05 +0200
commit28bd8342981b7a0933d48affc88a3dc7c593296b (patch)
tree5cc6b48678d39bce9e18c56b7742ad6563b1ec82 /core/object.cpp
parent945ed76adb2bf54b1535f03047f642daa79f2cff (diff)
parent2b5545270a60a1a60f57c91bb565131dc03de74d (diff)
Merge pull request #39394 from akien-mga/objectdb-cleanup-hints
Core: Add hints to run with --verbose when leaking nodes/resources at exit
Diffstat (limited to 'core/object.cpp')
-rw-r--r--core/object.cpp5
1 files changed, 3 insertions, 2 deletions
diff --git a/core/object.cpp b/core/object.cpp
index f3c5a13809..3ea3e27d41 100644
--- a/core/object.cpp
+++ b/core/object.cpp
@@ -2038,7 +2038,7 @@ void ObjectDB::cleanup() {
if (slot_count > 0) {
spin_lock.lock();
- WARN_PRINT("ObjectDB Instances still exist!");
+ WARN_PRINT("ObjectDB instances leaked at exit (run with --verbose for details).");
if (OS::get_singleton()->is_stdout_verbose()) {
for (uint32_t i = 0; i < slot_count; i++) {
uint32_t slot = object_slots[i].next_free;
@@ -2049,12 +2049,13 @@ void ObjectDB::cleanup() {
node_name = " - Node name: " + String(obj->call("get_name"));
}
if (obj->is_class("Resource")) {
- node_name = " - Resource name: " + String(obj->call("get_name")) + " Path: " + String(obj->call("get_path"));
+ node_name = " - Resource path: " + String(obj->call("get_path"));
}
uint64_t id = uint64_t(slot) | (uint64_t(object_slots[slot].validator) << OBJECTDB_VALIDATOR_BITS) | (object_slots[slot].is_reference ? OBJECTDB_REFERENCE_BIT : 0);
print_line("Leaked instance: " + String(obj->get_class()) + ":" + itos(id) + node_name);
}
+ 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();
}