Commit 48fbad4
committed
fix(screenshot): destroy late texture in CaptureCompositedAfterFrame callback
If the editor spin loop times out before ScreenshotCapturer's coroutine fires
the callback, the callback would still later assign the captured Texture2D to
the (now-dead) local result variable. The texture itself would never reach the
consumer's finally-block DestroyTexture, leaking a Unity object until the next
domain reload.
Track caller-returned state; if the callback runs after timeout, destroy the
incoming texture immediately instead of assigning it.
Flagged by CodeRabbit on the prior commit.1 parent 0c277af commit 48fbad4
1 file changed
Lines changed: 14 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
243 | 243 | | |
244 | 244 | | |
245 | 245 | | |
246 | | - | |
| 246 | + | |
| 247 | + | |
| 248 | + | |
| 249 | + | |
| 250 | + | |
| 251 | + | |
| 252 | + | |
| 253 | + | |
| 254 | + | |
| 255 | + | |
| 256 | + | |
| 257 | + | |
| 258 | + | |
247 | 259 | | |
248 | 260 | | |
249 | 261 | | |
250 | 262 | | |
| 263 | + | |
251 | 264 | | |
252 | 265 | | |
253 | 266 | | |
| |||
0 commit comments