Commit 51ae47c
Fix shared_ptr reference cycle causing ASAN leaks in CoroTaskRunner
After a coroutine completes, the frame remains alive holding a captured
shared_ptr<CoroTaskRunner> back to its owner. This creates an unreachable
cycle: runner -> task_ -> frame -> shared_ptr<runner>.
Break the cycle in resume() by destroying the coroutine frame (task_ = {})
and the stored callable when the coroutine is done. Also fix runnable() to
handle the null-handle state after cleanup.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>1 parent 185921e commit 51ae47c
1 file changed
+12
-2
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
251 | 251 | | |
252 | 252 | | |
253 | 253 | | |
254 | | - | |
255 | 254 | | |
| 255 | + | |
| 256 | + | |
256 | 257 | | |
257 | 258 | | |
| 259 | + | |
| 260 | + | |
| 261 | + | |
| 262 | + | |
| 263 | + | |
| 264 | + | |
258 | 265 | | |
259 | 266 | | |
260 | 267 | | |
| |||
266 | 273 | | |
267 | 274 | | |
268 | 275 | | |
269 | | - | |
| 276 | + | |
| 277 | + | |
| 278 | + | |
270 | 279 | | |
271 | 280 | | |
272 | 281 | | |
| |||
292 | 301 | | |
293 | 302 | | |
294 | 303 | | |
| 304 | + | |
295 | 305 | | |
296 | 306 | | |
297 | 307 | | |
| |||
0 commit comments