Fix GUI buffer update with deferred allocation - #1557
Conversation
|
Your fix might be correct. But it might as well just hide the actual error. That is: does anybody know what that |
|
Thanks for checking the lifecycle semantics. The |
|
Also for future reference: Can you use the PR template we provide? It has a checklist of all the things that need testing, which is missing here. |
|
Thanks for the reviews and approvals. All current CI checks are green. I’ll make sure to use the repository PR template/checklist for future contributions. Please let me know if anything else is needed from my side before merge. |
Summary
Fixes #1508.
Gui::update_buffers()can be called whileexplicit_updateis false. In that mode the persistent vertex and index buffers are intentionally null until the first update, but the method dereferenced both pointers before allocating them.This change short-circuits the two conditions when the corresponding buffer is null, allowing the existing allocation and upload path to initialize both buffers.
Reproduction
On macOS Apple Silicon (M2 Pro, macOS 26.6, Apple Clang 21, Vulkan SDK 1.4.341), an AddressSanitizer harness using the real
GuiCpp::update_buffers()implementation and non-empty ImGui draw data reproduced a deterministic null dereference in the parent implementation:Validation
cmake --build build/repro --config Debug --target framework vulkan_samples -j4— passedctest --test-dir build/repro --output-on-failure— no tests found in this repository configurationpython3 scripts/copyright.py main --fix— passedgit diff --check— passed./scripts/clang_format.py main— could not run becauseclang-formatis not installedThe diff is limited to
framework/gui.h; no public API or dependency changes are included.