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

AddItem can fail the id assertion under certain conditions (Apple Silicon?) #771

Open
juliusl opened this issue Apr 9, 2024 · 2 comments

Comments

@juliusl
Copy link

juliusl commented Apr 9, 2024

Describe the bug
A clear and concise description of what the bug is.

If the window title is of a certain length, followed by an input widget (for the sake of this example InputText) w/ a certain length of label and hint, followed by a button w/ a label of a certain length, it can fail the assertion at line 9931 of Imgui.cpp.

To Reproduce
Steps to reproduce the behavior, or example code that triggers the bug.

This was tough to narrow down a repro for. It seems the characters used as well as lengths changes the overall result.

Will fail w/

Assertion failed: (id != window->ID && "Cannot have an empty ID at the root of a window. If you need an empty label, use ## and read the FAQ about how the ID Stack works!"), function ItemAdd, file imgui.cpp, line 9183.

imgui
            .window("aaaaaaa: aaa-aaaaaaaa-0.0.0") 
            .build(|| {
                let mut sc = String::new();
                imgui.input_text("aaaaaa aaaaaaaa##aaaaaa", &mut sc)
                    .hint("Type '*' to list all resources")
                    .enter_returns_true(true)
                    .build();
                imgui.button("aaaaaa##aaaaaaaa");
});

Will work (only difference is the hint is commented out)

imgui
            .window("aaaaaaa: aaa-aaaaaaaa-0.0.0") 
            .build(|| {
                let mut sc = String::new();
                imgui.input_text("aaaaaa aaaaaaaa##aaaaaa", &mut sc)
                    // .hint("Type '*' to list all resources")
                    .enter_returns_true(true)
                    .build();
                imgui.button("aaaaaa##aaaaaaaa");
});

Expected behavior
A clear and concise description of what you expected to happen.

Screenshots
If applicable, add screenshots to help explain your problem.

Please describe your environment

  • imgui-rs version [e.g. 0.4.0]: 0.11.0
  • Operating system version: Mac OS 14.2.1
  • Apple M1 Max
  • winit, wgpu, native

Other information
Add related issues, suggestions about how to fix, any other context here.

This doesn't seem to repro on Ubuntu 22.04 on x86-64 which is why I think it might be hardware related. It seems related to the scratch_txt buffer.

@salvatorebenedetto
Copy link

I believe this is due to #762 which has been fixed in cef617b but it is not included in 0.11.0, so until they make a new release you can try and check out manually cef617b or later.

@juliusl
Copy link
Author

juliusl commented Apr 18, 2024

@salvatorebenedetto thanks, your explanation clears that up. Hoping to see 0.12.0 soon.

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

No branches or pull requests

2 participants