Skip to content
Merged
Changes from 1 commit
Commits
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
fixup! create unnamed pyscope, make PyScope.GILState save
  • Loading branch information
yagweb committed Apr 7, 2017
commit ceaaef0333398dbe171876275d3e40613378e238
8 changes: 5 additions & 3 deletions src/runtime/pythonengine.cs
Original file line number Diff line number Diff line change
Expand Up @@ -573,7 +573,6 @@ public void Dispose()
return;
}
isDisposed = true;
AcquireLock();
ReleaseLock();
GC.SuppressFinalize(this);
}
Expand Down Expand Up @@ -957,7 +956,10 @@ public virtual void Dispose()
AcquireLock();
Runtime.XDecref(globals);
Copy link
Contributor

Choose a reason for hiding this comment

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

gc issue is most likely here. You'll need to check that the engine is initialize and that it isn't finalizing before running these.

Runtime.XDecref(locals);
Py.RemoveSession(this);
if(this.Parent == null)
{
Py.RemoveSession(this);
}
isDisposed = true;
}

Expand Down Expand Up @@ -1010,7 +1012,7 @@ public static PyScope Session(string name = null)

internal static void RemoveSession(PyScope scope)
{
if(scope.Parent == null)//top session
if(scope.Parent == null)//top scope
{
Sessions.Remove(scope);
if(scope.Name != null)
Expand Down