Skip to content
This repository was archived by the owner on Jul 22, 2023. It is now read-only.

Commit f4f5032

Browse files
committed
Fixed nPython.exe crash on Shutdown
1 parent 569cd94 commit f4f5032

1 file changed

Lines changed: 5 additions & 0 deletions

File tree

src/runtime/finalizer.cs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,11 @@ internal void AddFinalizedObject(IDisposable obj)
8080

8181
internal static void Shutdown()
8282
{
83+
if (Runtime.Py_IsInitialized() == 0)
84+
{
85+
Instance._objQueue = new ConcurrentQueue<IDisposable>();
86+
return;
87+
}
8388
Instance.DisposeAll();
8489
Instance.CallPendingFinalizers();
8590
Runtime.PyErr_Clear();

0 commit comments

Comments
 (0)