Commit e4e20b8
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 3649044 commit e4e20b8
1 file changed
Lines changed: 25 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
24 | 24 | | |
25 | 25 | | |
26 | 26 | | |
27 | | - | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
28 | 40 | | |
29 | 41 | | |
30 | 42 | | |
| |||
92 | 104 | | |
93 | 105 | | |
94 | 106 | | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
95 | 115 | | |
96 | 116 | | |
97 | 117 | | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
98 | 122 | | |
99 | 123 | | |
100 | 124 | | |
| |||
0 commit comments