Skip to content

[5.9][Stdlib] Fix bridgedStorage lifetime in SwiftNativeNSArray._destroyBridgedStorage. #68432

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

Conversation

mikeash
Copy link
Contributor

@mikeash mikeash commented Sep 11, 2023

Cherry-pick #68403 to release/5.9.

Extend the lifetime of bridgedStorage until after the contents are deinitialized. When two threads race in withUnsafeBufferOfObjects, the loser uses _destroyBridgedStorage to destroy its candidate buffer, and we need to extend the lifetime of that buffer since the parameter is the only extant reference to it.

rdar://99565140

…royBridgedStorage.

Extend the lifetime of bridgedStorage until after the contents are deinitialized. When two threads race in withUnsafeBufferOfObjects, the loser uses _destroyBridgedStorage to destroy its candidate buffer, and we need to extend the lifetime of that buffer since the parameter is the only extant reference to it.

rdar://99565140
(cherry picked from commit acbcd5f)
@mikeash mikeash requested a review from a team as a code owner September 11, 2023 16:14
@mikeash
Copy link
Contributor Author

mikeash commented Sep 11, 2023

@swift-ci please test

@mikeash mikeash merged commit 3f85d2a into swiftlang:release/5.9 Sep 12, 2023
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