@@ -17662,6 +17662,7 @@ void ImGui::UpdateDebugToolStackQueries()
1766217662
1766317663 // Clear hook when id stack tool is not visible
1766417664 g.DebugHookIdInfoId = 0;
17665+ tool->QueryHookActive = false;
1766517666 if (g.FrameCount != tool->LastActiveFrame + 1)
1766617667 return;
1766717668
@@ -17687,11 +17688,15 @@ void ImGui::UpdateDebugToolStackQueries()
1768717688 // Update hook
1768817689 stack_level = tool->StackLevel;
1768917690 if (stack_level == -1)
17691+ {
1769017692 g.DebugHookIdInfoId = query_main_id;
17693+ tool->QueryHookActive = true;
17694+ }
1769117695 else if (stack_level >= 0 && stack_level < tool->Results.Size)
1769217696 {
1769317697 g.DebugHookIdInfoId = tool->Results[stack_level].ID;
1769417698 tool->Results[stack_level].QueryFrameCount++;
17699+ tool->QueryHookActive = true;
1769517700 }
1769617701}
1769717702
@@ -17701,11 +17706,17 @@ void ImGui::DebugHookIdInfo(ImGuiID id, ImGuiDataType data_type, const void* dat
1770117706 ImGuiContext& g = *GImGui;
1770217707 ImGuiWindow* window = g.CurrentWindow;
1770317708 ImGuiIDStackTool* tool = &g.DebugIDStackTool;
17709+ if (tool->QueryHookActive == false)
17710+ {
17711+ IM_ASSERT(id == 0);
17712+ return;
17713+ }
1770417714
1770517715 // Step 0: stack query
1770617716 // This assumes that the ID was computed with the current ID stack, which tends to be the case for our widget.
1770717717 if (tool->StackLevel == -1)
1770817718 {
17719+ IM_ASSERT(tool->Results.Size == 0);
1770917720 tool->StackLevel++;
1771017721 tool->Results.resize(window->IDStack.Size + 1, ImGuiStackLevelInfo());
1771117722 for (int n = 0; n < window->IDStack.Size + 1; n++)
0 commit comments