Skip to content

Crash in stack tool due to multiple PushOverrideID() with same id #8937

Closed

Description

@rokas-kbit

Version/Branch of Dear ImGui:

Version 1.92.2b, Branch: docking

Back-ends:

imgui_impl_sdl3.cpp + imgui_impl_opengl3.cpp

Compiler, OS:

Linux + GCC 13

Full config/build information:

Dear ImGui 1.92.2b (19222)
--------------------------------
sizeof(size_t): 8, sizeof(ImDrawIdx): 2, sizeof(ImDrawVert): 20
define: __cplusplus=202100
define: IMGUI_ENABLE_TEST_ENGINE
define: __linux__
define: __GNUC__=13
define: IMGUI_HAS_VIEWPORT
define: IMGUI_HAS_DOCK
--------------------------------
io.BackendPlatformName: imgui_impl_sdl3 (3.2.20; 3.2.20)
io.BackendRendererName: imgui_impl_opengl3
io.ConfigFlags: 0x00000081
 NavEnableKeyboard
 DockingEnable
io.ConfigViewportsNoDecoration
io.ConfigNavCaptureKeyboard
io.ConfigInputTextCursorBlink
io.ConfigWindowsResizeFromEdges
io.ConfigMemoryCompactTimer = 60.0
io.BackendFlags: 0x0000101E
 HasMouseCursors
 HasSetMousePos
 RendererHasVtxOffset
 RendererHasTextures
 RendererHasViewports
--------------------------------
io.Fonts: 3 fonts, Flags: 0x00000000, TexSize: 512,128
io.Fonts->FontLoaderName: stb_truetype
io.DisplaySize: 2048.00,1243.00
io.DisplayFramebufferScale: 1.00,1.00
--------------------------------
style.WindowPadding: 8.00,8.00
style.WindowBorderSize: 1.00
style.FramePadding: 4.00,3.00
style.FrameRounding: 0.00
style.FrameBorderSize: 0.00
style.ItemSpacing: 8.00,4.00
style.ItemInnerSpacing: 4.00,4.00

Details:

PushOverrideID() multiple times with same id at different id stack depths confuses stack tool leading to a crash.

Call stack:

ImVector<ImGuiStackLevelInfo>::operator[](ImVector<ImGuiStackLevelInfo> * const this, int i) (imgui.h:2273)
ImGui::DebugHookIdInfo(ImGuiID id, ImGuiDataType data_type, const void * data_id, const void * data_id_end) (imgui.cpp:23563)
ImGui::PushOverrideID(ImGuiID id) (imgui.cpp:9655)
Gui::GuiMain(const Gui::ApplicationFactory & app_factory, int argc, char ** argv) (GuiMain.cpp:338)
main(int argc, char ** argv) (Main.cpp:14)

To reproduce:

  1. Run reproducer code
  2. Open stack tool

Screenshots/Video:

No response

Minimal, Complete and Verifiable Example code:

ImGui::Begin("Test Window", nullptr, ImGuiWindowFlags_NoSavedSettings);
ImGui::PushOverrideID(0);
ImGui::PopID(); // PushOverrideID(0)
ImGui::Button("Btn1");
ImGui::PushID("Test");
ImGui::PushOverrideID(0);
ImGui::PopID(); // PushOverrideID(0)
ImGui::Button("Btn2");
ImGui::PopID(); // Test
ImGui::End();

Activity

  1. ocornut commented on Sep 17, 2025

    @ocornut
    Owner

    Thanks for your report!
    Pushed a fix for this 9cf9d2b. It actually only happened with PushOverrideID(0).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions

      ⌂ 换网址