Skip to content

Fix Windows .alwaysMapped deallocator #1147

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jan 29, 2025

Conversation

z2oh
Copy link
Contributor

@z2oh z2oh commented Jan 29, 2025

The custom deallocator is passed a pointer to the allocated buffer, not the underlying handle. The call to CloseHandle here was failing with ERROR_INVALID_HANDLE, but by changing the callback parameter to shadow pData instead of hMapping (and updating the call to UnmapViewOfFile), the call to CloseHandle now runs on the expected captured hMapping handle.

cc @compnerd

@compnerd compnerd self-requested a review January 29, 2025 20:45
Copy link
Member

@compnerd compnerd left a comment

Choose a reason for hiding this comment

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

This does match the documentation at https://developer.apple.com/documentation/foundation/data

@compnerd
Copy link
Member

@swift-ci please test Linux platform

@compnerd
Copy link
Member

@swift-ci please test Windows platform

@compnerd
Copy link
Member

Please cherry-pick this over to release/6.1

@compnerd compnerd merged commit 281db8e into swiftlang:main Jan 29, 2025
2 checks passed
z2oh added a commit to z2oh/swift-foundation that referenced this pull request Jan 29, 2025
@z2oh
Copy link
Contributor Author

z2oh commented Jan 29, 2025

Cherry-pick to release/6.1: #1148

compnerd pushed a commit that referenced this pull request Jan 29, 2025
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.

2 participants