Skip to content

Commit

Permalink
make non-editor builds less verbose by moving messages for resources …
Browse files Browse the repository at this point in the history
…still in use and ObjectDB instances leak at exit to print only when verbose
  • Loading branch information
rfht committed Aug 14, 2023
1 parent 7ba79d6 commit 13e6a1f
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
5 changes: 5 additions & 0 deletions core/io/resource.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -480,8 +480,13 @@ RWLock ResourceCache::path_cache_lock;

void ResourceCache::clear() {
if (resources.size()) {
#ifdef TOOLS_ENABLED
ERR_PRINT("Resources still in use at exit (run with --verbose for details).");
#endif
if (OS::get_singleton()->is_stdout_verbose()) {
#ifndef TOOLS_ENABLED
ERR_PRINT("Resources still in use at exit.");
#endif
for (const KeyValue<String, Resource *> &E : resources) {
print_line(vformat("Resource still in use: %s (%s)", E.key, E.value->get_class()));
}
Expand Down
5 changes: 5 additions & 0 deletions core/object/object.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2046,8 +2046,13 @@ void ObjectDB::cleanup() {
if (slot_count > 0) {
spin_lock.lock();

#ifdef TOOLS_ENABLED
WARN_PRINT("ObjectDB instances leaked at exit (run with --verbose for details).");
#endif
if (OS::get_singleton()->is_stdout_verbose()) {
#ifndef TOOLS_ENABLED
WARN_PRINT("ObjectDB instances leaked at exit.");
#endif
// Ensure calling the native classes because if a leaked instance has a script
// that overrides any of those methods, it'd not be OK to call them at this point,
// now the scripting languages have already been terminated.
Expand Down

0 comments on commit 13e6a1f

Please sign in to comment.