diff --git a/src/runtime/classderived.cs b/src/runtime/classderived.cs index e55e89240..7de34420f 100644 --- a/src/runtime/classderived.cs +++ b/src/runtime/classderived.cs @@ -857,7 +857,7 @@ public static void Finalize(IPythonDerivedType obj) { if (0 == Runtime.Py_IsInitialized() || Runtime.IsFinalizing) { - self.gcHandle.Free(); + if (self.gcHandle.IsAllocated) self.gcHandle.Free(); return; } } @@ -872,7 +872,7 @@ public static void Finalize(IPythonDerivedType obj) // If python's been terminated then just free the gchandle. if (0 == Runtime.Py_IsInitialized() || Runtime.IsFinalizing) { - self.gcHandle.Free(); + if (self.gcHandle.IsAllocated) self.gcHandle.Free(); return; }
Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.
Alternative Proxies: