Commit 98101f5
Detach textures from framebuffers before deleting
GL drivers keep internal references to textures attached to
framebuffers. Deleting a texture while still attached can cause
use-after-free in driver memory, observed as crashes on NVIDIA
during rapid preset switching or window resize.
Detach all textures before deletion in both ~Framebuffer() and
SetSize(), using a three-phase detach → resize → reattach pattern
in SetSize() to avoid referencing stale texture IDs.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>1 parent 16f40af commit 98101f5
1 file changed
Lines changed: 5 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
24 | 24 | | |
25 | 25 | | |
26 | 26 | | |
27 | | - | |
28 | | - | |
29 | | - | |
| 27 | + | |
30 | 28 | | |
31 | 29 | | |
| 30 | + | |
| 31 | + | |
32 | 32 | | |
33 | 33 | | |
34 | 34 | | |
| |||
94 | 94 | | |
95 | 95 | | |
96 | 96 | | |
| 97 | + | |
| 98 | + | |
97 | 99 | | |
98 | 100 | | |
99 | 101 | | |
| |||
0 commit comments