Fixed crash when appending with BeginMainMenuBar() more than once and no other window are showing. (#2567) + comments

This commit is contained in:
omar
2019-05-21 12:18:34 +02:00
parent 392ab08580
commit 882d2c3aea
3 changed files with 9 additions and 4 deletions

View File

@ -5850,7 +5850,7 @@ void ImGui::EndMainMenuBar()
// When the user has left the menu layer (typically: closed menus through activation of an item), we restore focus to the previous window
// FIXME: With this strategy we won't be able to restore a NULL focus.
ImGuiContext& g = *GImGui;
if (g.CurrentWindow == g.NavWindow && g.NavLayer == 0)
if (g.CurrentWindow == g.NavWindow && g.NavLayer == 0 && !g.NavAnyRequest)
FocusTopMostWindowUnderOne(g.NavWindow, NULL);
End();