Skip to content

features/string_view: ImGui::TreeNodeEx() has different IDs when id is const char*/string literal #5079

@Squareys

Description

@Squareys

Version/Branch of Dear ImGui:

Version: v1.87
Branch: docking + features/string_view

Back-end/Renderer/Compiler/OS

Back-ends: Magnum ImGuiIntegration
Compiler: MSVC19
Operating System: Windows 10

My Issue/Question:

Previously, when specifying the id of a tree node by string literal, the id would be pushed as string, now the same call leads to it being pushed as pointer (i.e. the const void* id overload seems to take precendence over the new ImStrv overload).

Standalone, minimal, complete and verifiable example:

    ImGuiTreeNodeFlags nodeFlags = ImGuiTreeNodeFlags_DefaultOpen|ImGuiTreeNodeFlags_OpenOnArrow;

    // Previously would push "root" to ID stack, now pushes some pointer, 0x1234ABCD...
    ImGui::TreeNodeEx("root", nodeFlags, "root");
    
    // Currently required workaround, correctly pushes "root"
    ImGui::TreeNodeEx(ImStrv{"root"}, nodeFlags, "root");

PS: I am aware that features/string_view is highly unstable and not production ready. I'm posting this issue only because you might find it useful/helpful, I'm not expecting a fix anytime soon.

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions