Explorar o código

Merge pull request #25078 from neikeq/mm-a

C#: Fix crash due to missing gchandle ref null check
Ignacio Etcheverry %!s(int64=6) %!d(string=hai) anos
pai
achega
938a2515cb
Modificáronse 1 ficheiros con 1 adicións e 1 borrados
  1. 1 1
      modules/mono/csharp_script.cpp

+ 1 - 1
modules/mono/csharp_script.cpp

@@ -1189,7 +1189,7 @@ bool CSharpLanguage::refcount_decremented_instance_binding(Object *p_object) {
 		return refcount == 0;
 	Ref<MonoGCHandle> &gchandle = ((Map<Object *, CSharpScriptBinding>::Element *)data)->get().gchandle;
 
-	if (refcount == 1 && !gchandle->is_weak()) { // The managed side also holds a reference, hence 1 instead of 0
+	if (refcount == 1 && gchandle.is_valid() && !gchandle->is_weak()) { // The managed side also holds a reference, hence 1 instead of 0
 		// If owner owner is no longer referenced by the unmanaged side,
 		// the managed instance takes responsibility of deleting the owner when GCed.