1
0
mirror of https://github.com/godotengine/godot.git synced 2025-11-18 14:21:41 +00:00

Mono/C#: Lighten up unsafe reference checks

Because of the weird case with multi-threading and ResourceLoader, it can be the case that a resource is GCed while being referenced again in the main thread. In such cases, a new unsafe reference is created before the finalizer thread removes the previous one.
This commit is contained in:
Ignacio Etcheverry
2020-01-23 21:23:32 +01:00
parent 1c0995d450
commit 55b2e58a98
2 changed files with 25 additions and 7 deletions

View File

@@ -308,8 +308,9 @@ class CSharpLanguage : public ScriptLanguage {
Map<Object *, CSharpScriptBinding> script_bindings;
#ifdef DEBUG_ENABLED
// List of unsafely referenced objects
List<ObjectID> unsafely_referenced_objects;
// List of unsafe object references
Map<ObjectID, int> unsafe_object_references;
Mutex *unsafe_object_references_lock;
#endif
struct StringNameCache {