Backends: Vulkan: Fixed use-after-free in multi-viewport dynamic rendering path (#9390, #9468)

This commit is contained in:
Turtle Dove
2026-07-13 08:07:08 -05:00
committed by ocornut
parent 6029ee3789
commit 162ce49af2
2 changed files with 6 additions and 1 deletions

View File

@@ -29,6 +29,7 @@
// CHANGELOG
// (minor and older changes stripped away, please see git history for details)
// 2026-XX-XX: Platform: Added support for multiple windows via the ImGuiPlatformIO interface.
// 2026-07-15: [Docking] Vulkan: fixed use-after-free when using multi-viewport with dynamic rendering path: deep-copy SurfaceFormat.format into the persistent buffer instead of storing a pointer to the viewport's wd->SurfaceFormat which dangles after the viewport is destroyed. (#9390, #9468)
// 2026-04-23: Added support for standard draw callbacks (in platform_io): DrawCallback_ResetRenderState, DrawCallback_SetSamplerLinear, DrawCallback_SetSamplerNearest. (#9378)
// 2026-04-22: *BREAKING CHANGE* redesigned to use separate ImageView + Sampler instead of Combined Image Sampler. This change allows us to facilitate changing samplers, in line with other backends.
// - When registering custom textures: changed ImGui_ImplVulkan_AddTexture() signature to remove Sampler.
@@ -2127,7 +2128,9 @@ static void ImGui_ImplVulkan_CreateWindow(ImGuiViewport* viewport)
{
pipeline_info->PipelineRenderingCreateInfo.sType = VK_STRUCTURE_TYPE_PIPELINE_RENDERING_CREATE_INFO;
pipeline_info->PipelineRenderingCreateInfo.colorAttachmentCount = 1;
pipeline_info->PipelineRenderingCreateInfo.pColorAttachmentFormats = &wd->SurfaceFormat.format;
bd->PipelineRenderingCreateInfoColorAttachmentFormats.resize(1);
bd->PipelineRenderingCreateInfoColorAttachmentFormats[0] = wd->SurfaceFormat.format;
pipeline_info->PipelineRenderingCreateInfo.pColorAttachmentFormats = bd->PipelineRenderingCreateInfoColorAttachmentFormats.Data;
}
else
{

View File

@@ -180,6 +180,8 @@ Docking+Viewports Branch:
change when docked. (#9355, #9443) [@reybits]
- Backends:
- Metal4: added multi-viewport support. (#9465, #9451) [@hoffstadt]
- Vulkan: fixed use after-free when using multi-viewports with dynamic rendering.
(#9390, #9468) [@vikhik, @Turtle-PB]
-----------------------------------------------------------------------