Merge pull request #85464 from KoBeWi/only_say_verbose_when_not_verbose

Improve message about resources in use at exit
This commit is contained in:
Yuri Sizov 2023-12-19 13:01:59 +01:00
commit d8a65b3f46
1 changed files with 4 additions and 2 deletions

View File

@ -489,12 +489,14 @@ RWLock ResourceCache::path_cache_lock;
#endif
void ResourceCache::clear() {
if (resources.size()) {
ERR_PRINT("Resources still in use at exit (run with --verbose for details).");
if (!resources.is_empty()) {
if (OS::get_singleton()->is_stdout_verbose()) {
ERR_PRINT(vformat("%d resources still in use at exit.", resources.size()));
for (const KeyValue<String, Resource *> &E : resources) {
print_line(vformat("Resource still in use: %s (%s)", E.key, E.value->get_class()));
}
} else {
ERR_PRINT(vformat("%d resources still in use at exit (run with --verbose for details).", resources.size()));
}
}