Skip to content

Conversation

Xazax-hun
Copy link
Contributor

@Xazax-hun Xazax-hun commented Sep 15, 2025

Explanation: Implicit value constructors did not account for unowned ownership resulting in unbalanced refcounts and use after free errors. This PR makes sure we +1 the unowned constructor arguments to balance out the ref counts.
Issues: rdar://160232360
Original PRs: #84203
Risk: Low, the fix is narrow to implicit value ctors taking foreign reference types and this scenario was broken before the patch.
Testing: Added a compiler test.
Reviewers: @egorzhdan, @jckarter

@Xazax-hun Xazax-hun requested a review from a team as a code owner September 15, 2025 14:17
@Xazax-hun Xazax-hun added c++ interop Feature: Interoperability with C++ 🍒 release cherry pick Flag: Release branch cherry picks swift 6.2 labels Sep 15, 2025
@Xazax-hun Xazax-hun force-pushed the handle-unowned-in-impicit-value-init-on-6.2 branch from 4bb197c to bd40aac Compare September 25, 2025 15:16
…mpicit-value-init

[cxx-interop] Handle Unowned values in implicit value ctors
@Xazax-hun Xazax-hun force-pushed the handle-unowned-in-impicit-value-init-on-6.2 branch from bd40aac to 9e1b104 Compare September 25, 2025 15:20
@Xazax-hun
Copy link
Contributor Author

@swift-ci please test

@Xazax-hun Xazax-hun merged commit 711b9df into swiftlang:release/6.2 Sep 26, 2025
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

c++ interop Feature: Interoperability with C++ 🍒 release cherry pick Flag: Release branch cherry picks swift 6.2

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants