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

Window stack unrolling #3600

Closed
fLindahl opened this issue Nov 17, 2020 · 1 comment
Closed

Window stack unrolling #3600

fLindahl opened this issue Nov 17, 2020 · 1 comment

Comments

@fLindahl
Copy link

Hi,
I'm currently implementing a scripted imgui environment, using DearGui python bindings.
It's a fairly common mistake to omit the ::End() call, and thus get an assertion about it.

I was wondering if this will yield me any wierd behaviour or obscure bugs:

ImGuiContext* g = ImGui::GetCurrentContext();
while (g->CurrentWindowStack.Size > 1)
{
	printWarning("ImGui window missing ::End()!\n");
	ImGui::End();
}

This would spit tons of warnings, but at least not crash the application, which would be detrimental in my use case.
I've of course tried it out, and it seems to work fine, but I'm left wondering if it's a dirty hack or actually an OK way of doing it.
Are there any other ways of making ImGui less "strict" with assertions?

I'm aware that there are other places where missing a corresponding End call might assert as well, but I'll worry about those later.

Thanks!

@ocornut
Copy link
Owner

ocornut commented Nov 18, 2020

This will work. Moving this thread to #1651 with a more complete answer.

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