Commit a36d996
committed
gfx/d3d10: null cbuffers[j].uniforms after free to match d3d11/d3d12 style
d3d10_free_shader_preset's inner loop frees the uniform buffer behind
each d3d10->pass[i].semantics.cbuffers[j].uniforms but does not null
the field out afterwards:
free(d3d10->pass[i].semantics.cbuffers[j].uniforms);
Release(d3d10->pass[i].buffers[j]);
The sibling d3d11_free_shader_preset and d3d12_free_shader_preset
both null the field:
free(d3d11->pass[i].semantics.cbuffers[j].uniforms);
d3d11->pass[i].semantics.cbuffers[j].uniforms = NULL;
Release(d3d11->pass[i].buffers[j]);
In practice the d3d10 version gets away with the omission because
the outer loop is followed by 'memset(d3d10->pass, 0,
sizeof(d3d10->pass))' which zeroes every pass's semantics block,
including the uniforms pointers, before the function returns. So
the end state is correct and currently-reachable code does not
observe the dangling pointer.
The inconsistency is still a hazard: if a future change adds an
early-return inside the inner loop, splits the loop body, or reorders
the memset away from the end, the transient dangling pointer becomes
persistent. Match the other two drivers' discipline so all three
free paths look the same and the pattern is less fragile to future
edits. No behaviour change on the currently-reachable paths.
Thread-safety: unchanged. d3d10_free_shader_preset runs on whatever
thread tears the shader preset down (typically the video thread);
no synchronisation introduced or affected.1 parent 9441128 commit a36d996
1 file changed
Lines changed: 1 addition & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1595 | 1595 | | |
1596 | 1596 | | |
1597 | 1597 | | |
| 1598 | + | |
1598 | 1599 | | |
1599 | 1600 | | |
1600 | 1601 | | |
| |||
0 commit comments