Skip to content

Commit

Permalink
Add missing TryAddRef case
Browse files Browse the repository at this point in the history
  • Loading branch information
slozier committed Jan 31, 2025
1 parent 326b6d9 commit d982810
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/core/IronPython.Modules/mmap.cs
Original file line number Diff line number Diff line change
Expand Up @@ -601,6 +601,11 @@ private bool TryAddRef(bool exclusive, out int reason) {
reason = StateBits.Exporting;
return false;
}
if (exclusive && ((oldState & StateBits.RefCount) > StateBits.RefCountOne)) {
// mmap in non-exclusive use, temporarily no exclusive use allowed
reason = StateBits.Exclusive;
return false;
}
Debug.Assert((oldState & StateBits.RefCount) > 0, "resurrecting disposed mmap object (disposed without being closed)");

newState = oldState + StateBits.RefCountOne;
Expand Down

0 comments on commit d982810

Please sign in to comment.