Skip to content

fix: guard buffer finalization during GC and shutdown - #614

Open
M-Colley wants to merge 1 commit into
BoboTiG:mainfrom
M-Colley:fix/issue-561-buffer-shutdown-cleanup
Open

M-Colley wants to merge 1 commit into
BoboTiG:mainfrom
M-Colley:fix/issue-561-buffer-shutdown-cleanup

Conversation

@M-Colley

@M-Colley M-Colley commented Dec 2, 2026

Copy link
Copy Markdown

Fixes #561

Cyclic garbage collection and interpreter shutdown can clear attributes on _FinalizingBufferIntermediate or MSSImplXShmGetImage before a downstream memoryview releases its buffer. Previously, buffer finalization raised AttributeError when _lock or _shm_lock was missing and left the shared-memory mapping open. _FinalizingBufferIntermediate.__del__ now stashes the pending inner view and finalizer on the class until __release_buffer__ runs, and __release_buffer__ releases the inner view even if instance state has been cleared. MSSImplXShmGetImage._release_shm_slot and _destroy_shm_slot close any remaining slot buffer when instance attributes are cleared and skip xcb.shm_detach during interpreter shutdown.

  • Tests added/updated (or your review concluded: not needed)
  • Documentation updated (or your review concluded: not needed)
  • Release notes added (or your review concluded: not needed)
  • ./check.sh (or ./check.ps1) passed

AI assistance disclosure

  • AI was entirely used to create this change.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Problems with buffer cleanup during interpreter shutdown

1 participant