8000 Release Windows clipboard memory locks after reading by voidsipp · Pull Request #699 · not-fl3/miniquad · GitHub
[go: up one dir, main page]

Skip to content

Release Windows clipboard memory locks after reading - #699

Open
voidsipp wants to merge 1 commit into
not-fl3:masterfrom
voidsipp:fix/549-unlock-clipboard-memory
Open

voidsipp wants to merge 1 commit into
not-fl3:masterfrom
voidsipp:fix/549-unlock-clipboard-memory

Conversation

@voidsipp
@voidsipp voidsipp commented Nov 3, 2026
Copy link
Copy Markdown

The Windows clipboard reader locks the clipboard memory without unlocking it. Add a guard that unlocks the handle after the text is copied, before the clipboard is closed. Also convert GlobalSize's byte count to UTF-16 units so a missing terminator cannot make the reader scan past the allocation.

The regression fails before the fix with a lock count of one after reading. Tests use Windows memory allocations to check repeated reads, Unicode text, unterminated data and a failed lock, without changing the clipboard.

On Windows, all four all-feature library tests pass, the all-feature build passes, and clippy completes with existing warnings. The changed file passes rustfmt. The full test run has three graphics doc-test failures from OpenGL calls without an initialized context, and repository-wide formatting also fails in unchanged files. An interactive clipboard round trip was not tested.

Fixes #549.

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.

GlobalLock without corresponding GlobalUnlock

1 participant

0