瀏覽代碼

Fix false reporting unclaimed StringName at exit due to static refs

Ignacio Roldán Etcheverry 3 年之前
父節點
當前提交
0e659b4230
共有 1 個文件被更改,包括 9 次插入6 次删除
  1. 9 6
      core/string/string_name.cpp

+ 9 - 6
core/string/string_name.cpp

@@ -84,12 +84,15 @@ void StringName::cleanup() {
 	for (int i = 0; i < STRING_TABLE_LEN; i++) {
 	for (int i = 0; i < STRING_TABLE_LEN; i++) {
 		while (_table[i]) {
 		while (_table[i]) {
 			_Data *d = _table[i];
 			_Data *d = _table[i];
-			lost_strings++;
-			if (d->static_count.get() != d->refcount.get() && OS::get_singleton()->is_stdout_verbose()) {
-				if (d->cname) {
-					print_line("Orphan StringName: " + String(d->cname));
-				} else {
-					print_line("Orphan StringName: " + String(d->name));
+			if (d->static_count.get() != d->refcount.get()) {
+				lost_strings++;
+
+				if (OS::get_singleton()->is_stdout_verbose()) {
+					if (d->cname) {
+						print_line("Orphan StringName: " + String(d->cname));
+					} else {
+						print_line("Orphan StringName: " + String(d->name));
+					}
 				}
 				}
 			}
 			}