Expand Up
@@ -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;
}
}
Expand All
@@ -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;
}
Expand Down