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

Assertion failed in menu. #4640

Closed
urjskhzk opened this issue Oct 10, 2021 · 2 comments
Closed

Assertion failed in menu. #4640

urjskhzk opened this issue Oct 10, 2021 · 2 comments
Labels
bug menus menu bars, menu items popups

Comments

@urjskhzk
Copy link

Version/Branch of Dear ImGui:

Version: 1.84.2
Branch: master

Back-end/Renderer/Compiler/OS

Back-ends: win32 dx9
Compiler: vs2019
Operating System: Windows 10

My Issue/Question:

ImGui::FindWindowFocusIndex
IM_ASSERT(g.WindowsFocusOrder[order] == window);

window->Name: ##Menu_01
window->FocusOrder: 0

g.WindowsFocusOrder
Size: 4
[0]: Debug##Default
[1]: Hello, world!
[2]: Dear ImGui Demo
[3]: ##Menu_00

The release version doesn't crash, but it does force the 'Menu' to close.

Screenshots/Video

1

Standalone, minimal, complete and verifiable example:

@ocornut ocornut added bug menus menu bars, menu items labels Oct 11, 2021
@ocornut
Copy link
Owner

ocornut commented Oct 11, 2021

Thank you for reporting this!
Confirmed repro (was easier to repro by resizing the host window down so the menus would be pushed back toward the left), will investigate

ocornut added a commit that referenced this issue Oct 11, 2021
…ested menus (broken in 1.83). (#4640)

Broken since 936f532
Weirdly chain-reaction caused by the fact following #4640 repro, the SourceWindow assignment in OpenPopupEx() picks Menu_04 before its closure. Value of SourceWindow since bda2cde #2517
@ocornut
Copy link
Owner

ocornut commented Oct 11, 2021

Pushed a fix ba5c105. Thanks for reporting this!

Which while debugging also led me on a tangent of thinking the value of OpenPopupStack[n].SourceWindow may be inadequate for some uses since bda2cde and #2517, but actually it makes sense that it would record the last focused window here (the Colors menu, 4th in the stack in your gif). Right now I can't find another issue I'm just writing this down and linking the issues # for future reference.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug menus menu bars, menu items popups
Projects
None yet
Development

No branches or pull requests

2 participants