Skip to content
Merged
Changes from 1 commit
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
8083f3b
Finalizer for PyObject
amos402 Jun 23, 2018
af33e74
Avoid test interdependency
amos402 Jun 24, 2018
6d9f897
Add source to .csproj
amos402 Jun 24, 2018
7140fd0
Make sure recover the environment
amos402 Jun 24, 2018
f66697d
Add StackTrace of C# exception
amos402 Jun 24, 2018
799d37e
Clean up the test and interface
amos402 Jun 24, 2018
cb55163
Update CHANGELOG.md
amos402 Jun 24, 2018
bfc0392
Mono doesn't have GC.WaitForFullGCComplete
amos402 Jun 24, 2018
59b614d
Fixed PythonException leak
amos402 Jun 25, 2018
569cd94
Merge branch 'master' into pyobject-finalizer
den-run-ai Jul 5, 2018
f4f5032
Fixed nPython.exe crash on Shutdown
amos402 Jul 10, 2018
0967a12
Merge branch 'master' into pyobject-finalizer
filmor Jul 17, 2018
f071c55
Add error handler
amos402 Aug 4, 2018
cfda491
Merge branch 'master' into pyobject-finalizer
amos402 Aug 4, 2018
f6c6e42
Merge branch 'master' into pyobject-finalizer
filmor Aug 30, 2018
0d96641
Make collect callback without JIT
amos402 Sep 6, 2018
34713f7
Merge branch 'master' into pyobject-finalizer
filmor Oct 16, 2018
b4e30ac
Merge branch 'master' into pyobject-finalizer
filmor Oct 17, 2018
f836ffa
Merge remote-tracking branch 'remotes/upstream/master' into pyobject-…
amos402 Oct 20, 2018
a4bb82d
Add pending marker
amos402 Oct 23, 2018
21da86d
Merge branch 'master' into pyobject-finalizer
amos402 Oct 24, 2018
5254c65
Remove PYTHONMALLOC setting
amos402 Oct 25, 2018
916e85e
Merge remote-tracking branch 'remotes/upstream/master' into pyobject-…
amos402 Nov 22, 2018
eee3683
Fix ref count error
amos402 Nov 22, 2018
cee8e17
Add ref count check for helping discover the bugs of decref too much
amos402 Nov 22, 2018
247e2d9
Fix ref count error
amos402 Nov 25, 2018
90c67ca
typo error
amos402 Nov 26, 2018
6d68d70
Merge branch 'master' into pyobject-finalizer
filmor Mar 6, 2019
4eff81e
Merge branch 'master' into pyobject-finalizer
filmor Mar 29, 2019
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Fixed nPython.exe crash on Shutdown
  • Loading branch information
amos402 committed Jul 10, 2018
commit f4f503222d1af92d60e09b00dcb0472c4a50a287
5 changes: 5 additions & 0 deletions src/runtime/finalizer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,11 @@ internal void AddFinalizedObject(IDisposable obj)

internal static void Shutdown()
{
if (Runtime.Py_IsInitialized() == 0)
{
Instance._objQueue = new ConcurrentQueue<IDisposable>();
return;
}
Instance.DisposeAll();
Instance.CallPendingFinalizers();
Runtime.PyErr_Clear();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why are you calling this?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Make sure no garbage left and clear the pending calls.
Pending calls wouldn't clear after calling Py_Finalize, if reset the .net environment, the function pointers would point to unknown memory and cause crash on calling them.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why are you calling PyErr_Clear?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

emmm...It seems I should expose the exceptions in DisposeAll after each obj.Dispose()

Expand Down