Backends: DX10, DX11: avoid ImGui_ImplXXXX_SwapBuffers() handlers for secondary viewports crashing if SwapChain could not be created.

It's not really clear when that would fail but someone privately reported, and since we allow failure in ImGui_ImplDX11_CreateWindow() it makes sense to allow it here.
This commit is contained in:
ocornut
2025-10-10 18:31:20 +02:00
parent cab82d9c76
commit 8de97d14d8
3 changed files with 6 additions and 2 deletions

View File

@@ -800,7 +800,8 @@ static void ImGui_ImplDX11_RenderWindow(ImGuiViewport* viewport, void*)
static void ImGui_ImplDX11_SwapBuffers(ImGuiViewport* viewport, void*)
{
ImGui_ImplDX11_ViewportData* vd = (ImGui_ImplDX11_ViewportData*)viewport->RendererUserData;
vd->SwapChain->Present(0, 0); // Present without vsync
if (vd->SwapChain)
vd->SwapChain->Present(0, 0); // Present without vsync
}
static void ImGui_ImplDX11_InitMultiViewportSupport()