Skip to content

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