-
Notifications
You must be signed in to change notification settings - Fork 10.6k
[Observation] Restrict deinitialization fired events to be limited to one per registrar and send a \Self.self as the keypath to avoid property confusions #82307
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
83e6f32
to
473c5b5
Compare
… one per registrar and send a \Self.self as the keypath to avoid property confusions
473c5b5
to
071d5b5
Compare
@swift-ci please test |
@swift-ci please smoke test |
tracker = { | ||
found(selfKp) | ||
} | ||
break |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is this supposed to break from just the inner loop and then potentially overwrite the tracker
variable on a subsequent iteration?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yea, that would be a performance improvement
@swift-ci please test |
@swift-ci please smoke test |
@swift-ci please smoke test linux |
…e observations in memory (#82752) Explanation: This ensures a potential leak with SwiftUI and other systems using Observation do not leak observation closures when the potential Observable instances used are only weakly referenced inside the tracking closure. Scope: This is limited to the runtime behavior of Observable types and has no ABI or language level interactions. Issues: rdar://112167556 Original PRs: #79823 #82307 Risk: Low - This is very targeted to just Observation, however it is a behavioral change which does not make this a zero risk change. Testing: New unit tests were added to catch at least some of the potential cases this issue can occur with.
@swift-ci smoke test linux |
shall this be merged since the 6.2 version of it already has been? |
This ensures that the deinitialization triggering of observation is limited to one willSet/onChange event and that keypath that is claimed for that change is then
\Self.self
This resolves rdar://153655165