Nelarius / imnodes

A small, dependency-free node editor for dear imgui
MIT License
2.01k stars 245 forks source link

g.Windows.Size != g.WindowsTempSortBuffer.Size #39

Closed Martinii89 closed 4 years ago

Martinii89 commented 4 years ago

Running the code at the end in a plugin of my application causes the following exception to be thrown. I'm totally lost as to why this would happen.

    // This usually assert if there is a mismatch between the ImGuiWindowFlags_ChildWindow / ParentWindow values and DC.ChildWindows[] in parents, aka we've done something wrong.
    IM_ASSERT(g.Windows.Size == g.WindowsTempSortBuffer.Size);
    static bool init = false;
    if (!init) {
        imnodes::Initialize();
        init = true;
    }

    ImGui::Begin("simple node editor");

    imnodes::BeginNodeEditor();
    imnodes::EndNodeEditor();

    ImGui::End();
Nelarius commented 4 years ago

Hi @Martinii89 ! Mysterious error indeed 🤔 Judging from the ImGui source, it looks like this assert happens in ImGui::EndFrame? Could you maybe share more of the main loop and init code? I could maybe try to reproduce this assert.

Not sure if this helps at all, but BeginNodeEditor does call ImGui::BeginChild. Likewise, EndNodeEditor calls the matching ImGui::EndChild. But both of those functions are called, directly after ImGui::Begin(), so I'm not sure where the mismatch would be coming from 🤯

Nelarius commented 4 years ago

@Martinii89 if this is still an issue, feel free to reopen!