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

Skip to content

Commit 178cbc8

Browse files
committed
Release atexit manually
1 parent 0b9d2c1 commit 178cbc8

File tree

1 file changed

+10
-7
lines changed

1 file changed

+10
-7
lines changed

src/runtime/runtime.cs

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -463,14 +463,17 @@ private static void RunExitFuncs()
463463
// The runtime may not provided `atexit` module.
464464
return;
465465
}
466-
try
466+
using (atexit)
467467
{
468-
atexit.InvokeMethod("_run_exitfuncs").Dispose();
469-
}
470-
catch (PythonException e)
471-
{
472-
Console.Error.WriteLine(e);
473-
e.Dispose();
468+
try
469+
{
470+
atexit.InvokeMethod("_run_exitfuncs").Dispose();
471+
}
472+
catch (PythonException e)
473+
{
474+
Console.Error.WriteLine(e);
475+
e.Dispose();
476+
}
474477
}
475478
}
476479

0 commit comments

Comments
 (0)