Browse Source

C#: Fix crash when disposing Reference on domain finalize

Ignacio Etcheverry 6 years ago
parent
commit
b42f7b7fae
1 changed files with 2 additions and 0 deletions
  1. 2 0
      modules/mono/csharp_script.cpp

+ 2 - 0
modules/mono/csharp_script.cpp

@@ -1407,6 +1407,8 @@ bool CSharpInstance::_unreference_owner_unsafe() {
 	if (!unsafe_referenced)
 	if (!unsafe_referenced)
 		return false; // Already unreferenced
 		return false; // Already unreferenced
 
 
+	unsafe_referenced = false;
+
 	// Called from CSharpInstance::mono_object_disposed() or ~CSharpInstance()
 	// Called from CSharpInstance::mono_object_disposed() or ~CSharpInstance()
 
 
 	// Unsafe refcount decrement. The managed instance also counts as a reference.
 	// Unsafe refcount decrement. The managed instance also counts as a reference.