From 873fe34b3184d8b5e6daeeab178a510e22d35bef Mon Sep 17 00:00:00 2001 From: ocornut Date: Thu, 13 Nov 2025 15:05:16 +0100 Subject: [PATCH] Debug Tools: ID Stack Tool: preserve first data type, so user of PushOverrideID() e.g. TreeNode() elements don't get demoted from _String to _ID. --- imgui.cpp | 3 ++- imgui_internal.h | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/imgui.cpp b/imgui.cpp index 2664d3050..eed1686a3 100644 --- a/imgui.cpp +++ b/imgui.cpp @@ -17892,7 +17892,8 @@ void ImGui::DebugHookIdInfo(ImGuiID id, ImGuiDataType data_type, const void* dat tool->ResultPathsBuf.append(result, result_end + 1); // Include zero terminator } info->QuerySuccess = true; - info->DataType = (ImS8)data_type; + if (info->DataType == -1) + info->DataType = (ImS8)data_type; } static int StackToolFormatLevelInfo(ImGuiIDStackTool* tool, int n, bool format_for_ui, char* buf, size_t buf_size) diff --git a/imgui_internal.h b/imgui_internal.h index f065df6e4..48cd46d9d 100644 --- a/imgui_internal.h +++ b/imgui_internal.h @@ -2125,7 +2125,7 @@ struct ImGuiStackLevelInfo ImS8 DataType; // ImGuiDataType int DescOffset; // -1 or offset into parent's ResultPathsBuf - ImGuiStackLevelInfo() { memset(this, 0, sizeof(*this)); DescOffset = -1; } + ImGuiStackLevelInfo() { memset(this, 0, sizeof(*this)); DataType = -1; DescOffset = -1; } }; // State for ID Stack tool queries