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

Loading a faulty ini file with invalid docked size #7480

Open
Yves-911 opened this issue Apr 10, 2024 · 2 comments
Open

Loading a faulty ini file with invalid docked size #7480

Yves-911 opened this issue Apr 10, 2024 · 2 comments
Labels
docking settings .ini persistance

Comments

@Yves-911
Copy link

Version/Branch of Dear ImGui:

Version 1.89.9, Branch: docking

Back-ends:

custom win32

Compiler, OS:

MSVC2022 + Clang 17.6

Full config/build information:

No response

Details:

Loading an invalid ini file


We stumbled accross an ini file with some docking information like (note the 0 on y for the dock node)

[Docking][Data]
DockNode  ID=0x00000001 Pos=1339,543 Size=438,**0**
DockNode  ID=0x00000002 Pos=1348,625 Size=438,286 Selected=0x2E4EBCAA
DockSpace ID=0x6B28C284 Pos=199,928 Size=1154,818 CentralNode=1 Selected=0xD000C8B6

Which obviously trigs this assert IM_ASSERT(ancestor_node->Size.x > 0.0f && ancestor_node->Size.y > 0.0f); in static ImGuiDockNode* ImGui::DockContextBindNodeToWindow(ImGuiContext* ctx, ImGuiWindow* window) when trying to open a window that was docked into that node.

As this is really annoying for our users, I fixed it by setting the 0-sized value with the corresponding size of the window trying to instantiate that dock node. Works well so far.
I know that this is mainly due because we are manipulating the nodes in maybe a way that is not recommended with multiple hosted viewports in a Win32 app but my question is more :
Is there a proper way to deal with malformed ini files ? Or there will still be Asserts, making the ini file unusable ?

Thanks !
Yves.

Screenshots/Video:

No response

Minimal, Complete and Verifiable Example code:

// Here's some code anyone can copy and paste to reproduce your issue
ImGui::Begin("Example Bug");
MoreCodeToExplainMyIssue();
ImGui::End();
@ocornut ocornut added the settings .ini persistance label Apr 11, 2024
@ocornut
Copy link
Owner

ocornut commented Apr 11, 2024

I'd be willing to add some recovery for that data, but only if I had a repro that created this invalid data in the first place.
It's possible that your code manipulating node data is incorrect.

@ocornut ocornut changed the title Loading a faulty ini file. Loading a faulty ini file with invalid docked size Apr 11, 2024
@Yves-911
Copy link
Author

Thanks for your reply !
I don't have the time right now to dive into the root cause which is almost for sure on our side. Whenever I stumble on a 100% repro code, I'll update the thread.
I'll keep my local fix for now to unblock our users.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
docking settings .ini persistance
Projects
None yet
Development

No branches or pull requests

2 participants