-
-
Notifications
You must be signed in to change notification settings - Fork 11.7k
Crash when floating window starts outside monitor area #8385
Description
Version/Branch of Dear ImGui:
Version 1.91.8, Branch: docking
Back-ends:
imgui_impl_dx9.cpp + imgui_impl_win32.cpp
Compiler, OS:
Win 10 + MSVC
Full config/build information:
Dear ImGui 1.91.8 (19180)
--------------------------------
sizeof(size_t): 8, sizeof(ImDrawIdx): 2, sizeof(ImDrawVert): 20
define: __cplusplus=199711
define: _WIN32
define: _WIN64
define: _MSC_VER=1942
define: _MSVC_LANG=201402
define: IMGUI_HAS_VIEWPORT
define: IMGUI_HAS_DOCK
--------------------------------
io.BackendPlatformName: imgui_impl_win32
io.BackendRendererName: imgui_impl_dx9
io.ConfigFlags: 0x00000483
NavEnableKeyboard
NavEnableGamepad
DockingEnable
ViewportsEnable
io.ConfigViewportsNoDecoration
io.ConfigNavCaptureKeyboard
io.ConfigInputTextCursorBlink
io.ConfigWindowsResizeFromEdges
io.ConfigMemoryCompactTimer = 60.0
io.BackendFlags: 0x00001C0E
HasMouseCursors
HasSetMousePos
PlatformHasViewports
HasMouseHoveredViewport
RendererHasVtxOffset
RendererHasViewports
--------------------------------
io.Fonts: 1 fonts, Flags: 0x00000000, TexSize: 512,64
io.DisplaySize: 1264.00,761.00
io.DisplayFramebufferScale: 1.00,1.00
--------------------------------
style.WindowPadding: 8.00,8.00
style.WindowBorderSize: 1.00
style.FramePadding: 4.00,3.00
style.FrameRounding: 0.00
style.FrameBorderSize: 0.00
style.ItemSpacing: 8.00,4.00
style.ItemInnerSpacing: 4.00,4.00
Details:
Hi folks,
Found this crash and managed to repro it using ImGui's Example code without any changes
- Run Imgui's example project
- Undock the "Dear ImGui Demo" Window
- Close the program
- Find the imgui.ini file and change the
ViewportPosparam for "Dear ImGui Demo" to fall outside the monitor size (for example,ViewportPos=5000,5000) - Run again
- Crash
Found this in the wild when increasing the scale of my monitor, the window ended up outside the new (smaller) resolution and my application crashed.
Note this doesn't happen in imgui-1.90.9-docking. I believe the code that would clamp the window size in Begin() has been (re)moved
Callstack:
example_win32_directx9.exe!ImGui::SetCurrentViewport(ImGuiWindow * current_window, ImGuiViewportP * viewport) Line 15667 C++
example_win32_directx9.exe!ImGui::Begin(const char * name, bool * p_open, int flags) Line 7658 C++
example_win32_directx9.exe!ImGui::ShowDemoWindow(bool * p_open) Line 482 C++
example_win32_directx9.exe!main(int __formal, char * * __formal) Line 144 C++
example_win32_directx9.exe!invoke_main() Line 79 C++
example_win32_directx9.exe!__scrt_common_main_seh() Line 288 C++
example_win32_directx9.exe!__scrt_common_main() Line 331 C++
example_win32_directx9.exe!mainCRTStartup(void * __formal) Line 17 C++
Screenshots/Video:
No response
Minimal, Complete and Verifiable Example code:
ImGui's Example code without changes