Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DockBuilderCopyDockSpace crashes when windows not in remapping list are docked in a split #6035

Closed
cfillion opened this issue Dec 31, 2022 · 2 comments

Comments

@cfillion
Copy link
Contributor

cfillion commented Dec 31, 2022

Version/Branch of Dear ImGui:

Version: 1.89.1
Branch: docking

My Issue:

Using DockBuilderCopyDockSpace to move the contents of a dockspace to another crashes if the dockspace is split, contains a window in the first child (top or left) and nothing in the second child (bottom or right). (It works as expected in the opposite case: something in the second child and nothing in the first.)

Video

Take

Standalone, minimal, complete and verifiable example:

#include <imgui/imgui_internal.h>

if(ImGui::Begin("Main")) {
  if(ImGui::Button("Crash Me")) {
    ImVector<const char *> remap;
    ImGui::DockBuilderCopyDockSpace(~0, ~1, &remap);
  }
  ImGui::DockSpace(~0, { 300.f, 300.f });
  ImGui::SameLine();
  ImGui::DockSpace(~1, { 300.f, 300.f });
}
ImGui::End();

if(ImGui::Begin("Dock Me"))
  ImGui::Text("Lorem ipsum");
ImGui::End();
@ocornut ocornut changed the title DockBuilderCopyDockSpace crashes if ChildNodes[0] && !ChildNodes[1] DockBuilderCopyDockSpace crashes when windows not in remapping list are docked in a split Jan 2, 2023
ocornut added a commit that referenced this issue Jan 2, 2023
…n the remapping list are docked on the left or top side of a split. (#6035)
@ocornut
Copy link
Owner

ocornut commented Jan 2, 2023

Thank you for reporting this.
This happened when the window in the split section is not in the remapping list.
Fixed with 6939676

@ocornut ocornut closed this as completed Jan 2, 2023
@cfillion
Copy link
Contributor Author

cfillion commented Jan 2, 2023

Thanks and happy new year! 🎉

cfillion pushed a commit to cfillion/imgui that referenced this issue Jan 3, 2023
…n the remapping list are docked on the left or top side of a split. (ocornut#6035)
cfillion added a commit to cfillion/reaimgui that referenced this issue Jan 3, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants