From b42f7b7fae627de8db4bef5bc036e6b29a1aab04 Mon Sep 17 00:00:00 2001 From: Ignacio Etcheverry Date: Thu, 25 Oct 2018 17:21:42 +0200 Subject: [PATCH] C#: Fix crash when disposing Reference on domain finalize --- modules/mono/csharp_script.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/modules/mono/csharp_script.cpp b/modules/mono/csharp_script.cpp index 5160d42367b..6b3dc013066 100644 --- a/modules/mono/csharp_script.cpp +++ b/modules/mono/csharp_script.cpp @@ -1407,6 +1407,8 @@ bool CSharpInstance::_unreference_owner_unsafe() { if (!unsafe_referenced) return false; // Already unreferenced + unsafe_referenced = false; + // Called from CSharpInstance::mono_object_disposed() or ~CSharpInstance() // Unsafe refcount decrement. The managed instance also counts as a reference.