imgui icon indicating copy to clipboard operation
imgui copied to clipboard

Assert when splitting windows in a central node

Open UE4SS opened this issue 1 year ago • 0 comments

Version/Branch of Dear ImGui:

docking

Back-ends:

imgui_impl_glfw.cpp + imgui_impl_opengl3.cpp

Compiler, OS:

Windows 10 + MSVC

Full config/build information:

Dear ImGui 1.90.2 WIP (19013)
--------------------------------
sizeof(size_t): 8, sizeof(ImDrawIdx): 2, sizeof(ImDrawVert): 20
define: __cplusplus=199711
define: _WIN32
define: _WIN64
define: _MSC_VER=1937
define: _MSVC_LANG=202004
define: IMGUI_HAS_VIEWPORT
define: IMGUI_HAS_DOCK
--------------------------------
io.BackendPlatformName: imgui_impl_glfw
io.BackendRendererName: imgui_impl_opengl3
io.ConfigFlags: 0x00000443
 NavEnableKeyboard
 NavEnableGamepad
 DockingEnable
 ViewportsEnable
io.ConfigViewportsNoDecoration
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: 1280.00,720.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:

Using examples/example_glfw_opengl3/main.cpp with my minimal repro code instead of the three showcase steps causes this assert when dragging one of the windows from its pre-docked position to anywhere in the dockspace except in the middle:

IM_ASSERT(node->IsLeafNode() && "If you get this assert: please submit .ini file + repro of actions leading to this.");

Note that this doesn't happen if ImGuiDockNodeFlags_CentralNode isn't used. Here's the ini as requested:

[Window][Window 2]
Pos=68,87
Size=712,355
Collapsed=0
DockId=0x8C307CF1,0

[Window][Window 3]
ViewportPos=515,491
ViewportId=0x620C4F13
Size=712,355
Collapsed=0

[Window][Debug##Default]
Pos=60,60
Size=400,400
Collapsed=0

[Window][Window For Dockspace]
Pos=60,60
Size=728,390
Collapsed=0

[Docking][Data]
DockSpace ID=0x8C307CF1 Window=0x84CCF630 Pos=284,326 Size=712,355 CentralNode=1 Selected=0x82C5531C

Screenshots/Video:

No response

Minimal, Complete and Verifiable Example code:

static void crash_repro_minimal()
{
    if (ImGui::Begin("Window For Dockspace"))
    {
        auto dockspace_id = ImGui::GetID("Dockspace_Window");
        if (!ImGui::DockBuilderGetNode(dockspace_id))
        {
            ImGui::DockBuilderRemoveNode(dockspace_id);
            ImGui::DockBuilderAddNode(dockspace_id, ImGuiDockNodeFlags_DockSpace);
            ImGui::DockBuilderSetNodeSize(dockspace_id, { ImGui::GetWindowWidth(), 300.f });
            ImGui::DockBuilderDockWindow("Window 2", dockspace_id);
            ImGui::DockBuilderDockWindow("Window 3", dockspace_id);
            ImGui::DockBuilderFinish(dockspace_id);
        }
        ImGui::DockSpace(dockspace_id, {}, ImGuiDockNodeFlags_NoCloseButton | ImGuiDockNodeFlags_CentralNode);
        if (ImGui::Begin("Window 2"))
        {
            ImGui::Text("Window: Window 2", "Window 2");
        }
        ImGui::End();
        if (ImGui::Begin("Window 3"))
        {
            ImGui::Text("Window: Window 3", "Window 3");
        }
        ImGui::End();
    }
    ImGui::End();
}

UE4SS avatar Jan 21 '24 17:01 UE4SS