mirror of
https://github.com/ocornut/imgui.git
synced 2026-10-29 07:54:40 +00:00
Backends: DX11: crash in ImGui_ImplDX11_RenderWindow when a viewport's RTView is null (device removal on undock) #9546
Labels
No labels
accidentally closed
android
backends
bug
building
clipper
coloredit
color spaces
cplusplus
data types
demo
disabled
doc
docking
dpi
drag drop
drawing/drawlist
dropped
dx12
enhancement
focus
font/text
gallery
help wanted
idle/power saving
ime
in progress
inputs
inputtext
internals
label/id and id stack
language bindings
layout
linux/bsd
menus
multi-contexts
multi-threading
multi-viewports
nav
news/info
opengl
optimization
osx/ios
overlap
plot/graph
popups
question
scrolling
selection
settings
sliders/drags
style
tables/columns
tabs
test wanted
tools
tooltips
tree
tricks & tips
useful widgets
vulkan
web
window pos/depth
window sizing
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
ocornut/imgui#9546
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Version/Branch of Dear ImGui:
Version 1.93.0 WIP (19292), Branch: docking
Back-ends:
imgui_impl_win32.cpp + imgui_impl_dx11.cpp
Compiler, OS:
ndows 11 (build 26200) + MSVC 2022 (19.50), NVIDIA RTX 2000 Ada laptop GPU, 5 external 4K monitors at 150% DPI via a dock
Full config/build information:
N/A
Details:
Crash in
mGui_ImplDX11_RenderWindowwhen a secondary viewport's render target view isnull. Reproduced once in production when a laptop was undocked while several viewport windows were open on the dock's monitors; the crash landed during the display topology change (the app still enumerated all 5 monitors at crash time).The user cannot recall the exact conditions, and I've not been able to reproduce, but I suspect the cause.
Release-build callstack (system frames resolved to nearest export only):
ImGui_ImplDX11_RenderWindowmakes two direct D3D calls,OMSetRenderTargets(1, &vd->RTView, nullptr)andClearRenderTargetView(vd->RTView, ...).vd->RTViewstays null whenImGui_ImplDX11_SetWindowSizereturns early afterResizeBuffers/GetBufferfail (it prints "failed creating buffers"), and whenCreateSwapChainfails inImGui_ImplDX11_CreateWindow(theIM_ASSERTis compiled out in release).ClearRenderTargetView(nullptr)faults inside the runtime without the debug layer. Losing all displays on a discrete laptop GPU during undock is a knownDXGI_ERROR_DEVICE_REMOVEDtrigger, which fits.Proposed fix, two lines at the top of
ImGui_ImplDX11_RenderWindowaftervdis fetched:The viewport stays blank until a later
SetWindowSizesucceeds, rather than crashing the application.Screenshots/Video:
No response
Minimal, Complete and Verifiable Example code:
A faithful repro needs a device loss, which was hard to script.