Skip to content

Assertion in InputInt(label) after calling GetID(label) after value_changed #5181

@instinkt900

Description

@instinkt900

Version/Branch of Dear ImGui: 1.88 WIP

Version: 1.88 WIP
Branch: Docking

Back-end/Renderer/Compiler/OS

Back-ends: imgui_impl_sdl.cpp + imgui_impl_sdl_renderer.cpp
Compiler: MSVC 1929
Operating System: Win64

My Issue/Question:

I'm using ImGuiIDs to keep track of some stateful data and noticed that when I use GetID() before using InputInt() if I try to change the value using keyboard input I get an assertion in ImGui::MarkItemEdited() on IM_ASSERT(g.ActiveId == id || g.ActiveId == 0 || g.DragDropActive); where g.ActiveId seems to be the correct ID for my element but id is 0.
A minimal example of a repo is below.

static int testInt = 60;
auto const id = ImGui::GetID("Test Int");
ImGui::InputInt("Test Int", &testInt);

When selecting the input and hitting a key the assertion is fired. Note that it doesn't happen with InputFloat or InputInt with 0 as the stepping value (stepping buttons removed).

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions