Commit a349e64
authored
[Observation] Ensure deinitialized Observable types don't leave active observations in memory (swiftlang#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:
swiftlang#79823
swiftlang#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.1 parent 1dd4a99 commit a349e64
File tree
2 files changed
+55
-4
lines changed- stdlib/public/Observation/Sources/Observation
- test/stdlib/Observation
2 files changed
+55
-4
lines changedLines changed: 22 additions & 4 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
110 | 110 | | |
111 | 111 | | |
112 | 112 | | |
113 | | - | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
114 | 131 | | |
115 | 132 | | |
| 133 | + | |
116 | 134 | | |
117 | 135 | | |
118 | 136 | | |
| |||
157 | 175 | | |
158 | 176 | | |
159 | 177 | | |
160 | | - | |
161 | | - | |
| 178 | + | |
| 179 | + | |
162 | 180 | | |
163 | 181 | | |
164 | 182 | | |
| |||
189 | 207 | | |
190 | 208 | | |
191 | 209 | | |
192 | | - | |
| 210 | + | |
193 | 211 | | |
194 | 212 | | |
195 | 213 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
287 | 287 | | |
288 | 288 | | |
289 | 289 | | |
| 290 | + | |
| 291 | + | |
| 292 | + | |
| 293 | + | |
| 294 | + | |
| 295 | + | |
| 296 | + | |
| 297 | + | |
| 298 | + | |
| 299 | + | |
| 300 | + | |
| 301 | + | |
| 302 | + | |
| 303 | + | |
| 304 | + | |
| 305 | + | |
290 | 306 | | |
291 | 307 | | |
292 | 308 | | |
| |||
511 | 527 | | |
512 | 528 | | |
513 | 529 | | |
| 530 | + | |
| 531 | + | |
| 532 | + | |
| 533 | + | |
| 534 | + | |
| 535 | + | |
| 536 | + | |
| 537 | + | |
| 538 | + | |
| 539 | + | |
| 540 | + | |
| 541 | + | |
| 542 | + | |
| 543 | + | |
| 544 | + | |
| 545 | + | |
| 546 | + | |
514 | 547 | | |
515 | 548 | | |
516 | 549 | | |
| |||
0 commit comments