mirror of
				https://github.com/Drezil/imgui.git
				synced 2025-10-31 13:11:05 +01:00 
			
		
		
		
	Fixed crash when appending with BeginMainMenuBar() more than once and no other window are showing. (#2567) + comments
This commit is contained in:
		
							
								
								
									
										10
									
								
								imgui.cpp
									
									
									
									
									
								
							
							
						
						
									
										10
									
								
								imgui.cpp
									
									
									
									
									
								
							| @@ -2831,9 +2831,13 @@ bool ImGui::ItemAdd(const ImRect& bb, ImGuiID id, const ImRect* nav_bb_arg) | ||||
|     { | ||||
|         // Navigation processing runs prior to clipping early-out | ||||
|         //  (a) So that NavInitRequest can be honored, for newly opened windows to select a default widget | ||||
|         //  (b) So that we can scroll up/down past clipped items. This adds a small O(N) cost to regular navigation requests unfortunately, but it is still limited to one window. | ||||
|         //      it may not scale very well for windows with ten of thousands of item, but at least NavMoveRequest is only set on user interaction, aka maximum once a frame. | ||||
|         //      We could early out with "if (is_clipped && !g.NavInitRequest) return false;" but when we wouldn't be able to reach unclipped widgets. This would work if user had explicit scrolling control (e.g. mapped on a stick) | ||||
|         //  (b) So that we can scroll up/down past clipped items. This adds a small O(N) cost to regular navigation requests  | ||||
|         //      unfortunately, but it is still limited to one window. It may not scale very well for windows with ten of  | ||||
|         //      thousands of item, but at least NavMoveRequest is only set on user interaction, aka maximum once a frame. | ||||
|         //      We could early out with "if (is_clipped && !g.NavInitRequest) return false;" but when we wouldn't be able | ||||
|         //      to reach unclipped widgets. This would work if user had explicit scrolling control (e.g. mapped on a stick). | ||||
|         // We intentionally don't check if g.NavWindow != NULL because g.NavAnyRequest should only be set when it is non null. | ||||
|         // If we crash on a NULL g.NavWindow we need to fix the bug elsewhere. | ||||
|         window->DC.NavLayerActiveMaskNext |= window->DC.NavLayerCurrentMask; | ||||
|         if (g.NavId == id || g.NavAnyRequest) | ||||
|             if (g.NavWindow->RootWindowForNav == window->RootWindowForNav) | ||||
|   | ||||
		Reference in New Issue
	
	Block a user