summaryrefslogtreecommitdiffstats
path: root/core/resource.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/resource.cpp
parent945ed76adb2bf54b1535f03047f642daa79f2cff (diff)
parent2b5545270a60a1a60f57c91bb565131dc03de74d (diff)
downloadredot-engine-28bd8342981b7a0933d48affc88a3dc7c593296b.tar.gz
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/resource.cpp')
-rw-r--r--core/resource.cpp17
1 files changed, 9 insertions, 8 deletions
diff --git a/core/resource.cpp b/core/resource.cpp
index 0af8c9c2b3..3b589793ef 100644
--- a/core/resource.cpp
+++ b/core/resource.cpp
@@ -33,6 +33,7 @@
#include "core/core_string_names.h"
#include "core/io/resource_loader.h"
#include "core/os/file_access.h"
+#include "core/os/os.h"
#include "core/script_language.h"
#include "scene/main/node.h" //only so casting works
@@ -431,7 +432,14 @@ void ResourceCache::setup() {
void ResourceCache::clear() {
if (resources.size()) {
- ERR_PRINT("Resources Still in use at Exit!");
+ ERR_PRINT("Resources still in use at exit (run with --verbose for details).");
+ if (OS::get_singleton()->is_stdout_verbose()) {
+ const String *K = nullptr;
+ while ((K = resources.next(K))) {
+ Resource *r = resources[*K];
+ print_line(vformat("Resource still in use: %s (%s)", *K, r->get_class()));
+ }
+ }
}
resources.clear();
@@ -442,12 +450,6 @@ void ResourceCache::clear() {
}
void ResourceCache::reload_externals() {
- /*
- const String *K=nullptr;
- while ((K=resources.next(K))) {
- resources[*K]->reload_external_data();
- }
- */
}
bool ResourceCache::has(const String &p_path) {
@@ -530,6 +532,5 @@ void ResourceCache::dump(const char *p_file, bool p_short) {
}
lock->read_unlock();
-
#endif
}