mirror of
https://github.com/ocornut/imgui.git
synced 2026-01-09 23:54:20 +00:00
Debug Tools: ID Stack Tool: fixed a crash when using PushOverrideID(0) during a query. (#8937, #4631)
This commit is contained in:
parent
7e473d38d3
commit
9cf9d2be83
3 changed files with 14 additions and 0 deletions
|
|
@ -103,6 +103,8 @@ Other Changes:
|
||||||
is now skipped. (#8904, #4631)
|
is now skipped. (#8904, #4631)
|
||||||
- Debug Tools: ID Stack Tool: added option to hex-encode non-ASCII characters in
|
- Debug Tools: ID Stack Tool: added option to hex-encode non-ASCII characters in
|
||||||
output path. (#8904, #4631)
|
output path. (#8904, #4631)
|
||||||
|
- Debug Tools: ID Stack Tool: fixed a crash when using PushOverrideID(0) during
|
||||||
|
a query. (#8937, #4631)
|
||||||
- Debug Tools: Fixed assertion failure when opening a combo box while using
|
- Debug Tools: Fixed assertion failure when opening a combo box while using
|
||||||
io.ConfigDebugBeginReturnValueOnce/ConfigDebugBeginReturnValueLoop. (#8931) [@harrymander]
|
io.ConfigDebugBeginReturnValueOnce/ConfigDebugBeginReturnValueLoop. (#8931) [@harrymander]
|
||||||
- Demo: tweaked ShowFontSelector() and ShowStyleSelector() to update selection
|
- Demo: tweaked ShowFontSelector() and ShowStyleSelector() to update selection
|
||||||
|
|
|
||||||
11
imgui.cpp
11
imgui.cpp
|
|
@ -17662,6 +17662,7 @@ void ImGui::UpdateDebugToolStackQueries()
|
||||||
|
|
||||||
// Clear hook when id stack tool is not visible
|
// Clear hook when id stack tool is not visible
|
||||||
g.DebugHookIdInfoId = 0;
|
g.DebugHookIdInfoId = 0;
|
||||||
|
tool->QueryHookActive = false;
|
||||||
if (g.FrameCount != tool->LastActiveFrame + 1)
|
if (g.FrameCount != tool->LastActiveFrame + 1)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
|
@ -17687,11 +17688,15 @@ void ImGui::UpdateDebugToolStackQueries()
|
||||||
// Update hook
|
// Update hook
|
||||||
stack_level = tool->StackLevel;
|
stack_level = tool->StackLevel;
|
||||||
if (stack_level == -1)
|
if (stack_level == -1)
|
||||||
|
{
|
||||||
g.DebugHookIdInfoId = query_main_id;
|
g.DebugHookIdInfoId = query_main_id;
|
||||||
|
tool->QueryHookActive = true;
|
||||||
|
}
|
||||||
else if (stack_level >= 0 && stack_level < tool->Results.Size)
|
else if (stack_level >= 0 && stack_level < tool->Results.Size)
|
||||||
{
|
{
|
||||||
g.DebugHookIdInfoId = tool->Results[stack_level].ID;
|
g.DebugHookIdInfoId = tool->Results[stack_level].ID;
|
||||||
tool->Results[stack_level].QueryFrameCount++;
|
tool->Results[stack_level].QueryFrameCount++;
|
||||||
|
tool->QueryHookActive = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -17701,11 +17706,17 @@ void ImGui::DebugHookIdInfo(ImGuiID id, ImGuiDataType data_type, const void* dat
|
||||||
ImGuiContext& g = *GImGui;
|
ImGuiContext& g = *GImGui;
|
||||||
ImGuiWindow* window = g.CurrentWindow;
|
ImGuiWindow* window = g.CurrentWindow;
|
||||||
ImGuiIDStackTool* tool = &g.DebugIDStackTool;
|
ImGuiIDStackTool* tool = &g.DebugIDStackTool;
|
||||||
|
if (tool->QueryHookActive == false)
|
||||||
|
{
|
||||||
|
IM_ASSERT(id == 0);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
// Step 0: stack query
|
// Step 0: stack query
|
||||||
// This assumes that the ID was computed with the current ID stack, which tends to be the case for our widget.
|
// This assumes that the ID was computed with the current ID stack, which tends to be the case for our widget.
|
||||||
if (tool->StackLevel == -1)
|
if (tool->StackLevel == -1)
|
||||||
{
|
{
|
||||||
|
IM_ASSERT(tool->Results.Size == 0);
|
||||||
tool->StackLevel++;
|
tool->StackLevel++;
|
||||||
tool->Results.resize(window->IDStack.Size + 1, ImGuiStackLevelInfo());
|
tool->Results.resize(window->IDStack.Size + 1, ImGuiStackLevelInfo());
|
||||||
for (int n = 0; n < window->IDStack.Size + 1; n++)
|
for (int n = 0; n < window->IDStack.Size + 1; n++)
|
||||||
|
|
|
||||||
|
|
@ -2128,6 +2128,7 @@ struct ImGuiIDStackTool
|
||||||
int StackLevel; // -1: query stack and resize Results, >= 0: individual stack level
|
int StackLevel; // -1: query stack and resize Results, >= 0: individual stack level
|
||||||
ImGuiID QueryMainId; // ID to query details for
|
ImGuiID QueryMainId; // ID to query details for
|
||||||
ImVector<ImGuiStackLevelInfo> Results;
|
ImVector<ImGuiStackLevelInfo> Results;
|
||||||
|
bool QueryHookActive; // Used to disambiguate the case where DebugHookIdInfoId == 0 which is valid.
|
||||||
bool OptHexEncodeNonAsciiChars;
|
bool OptHexEncodeNonAsciiChars;
|
||||||
bool OptCopyToClipboardOnCtrlC;
|
bool OptCopyToClipboardOnCtrlC;
|
||||||
float CopyToClipboardLastTime;
|
float CopyToClipboardLastTime;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue