Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit f4f5032

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

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

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)