imgui icon indicating copy to clipboard operation
imgui copied to clipboard

ImGui with GLFW Press Key A Crash

Open SakurayYuzuru opened this issue 7 months ago • 1 comments

Version/Branch of Dear ImGui:

Branch: master

Back-ends:

imgui_impl_glfw.cpp + imgui_impl_opengl3.cpp

Compiler, OS:

Linux + GNUC

Full config/build information:

Linux (Ubuntu24.04), C++20, OpenGL4.6

Details:

I'm writing a Game Engine on my linux (ubuntu24.04) with GLFW and ImGui. When I pressed key 'A', the ImGui had a crash with #0 0x00007ffff7cd8646 in ImGui::ErrorRecoveryTryToRecoverWindowState (state_in=0x5555557af090) at /home/sakuray/Documents/MyTools/Sakuray-Engine/Sakuray/3rdparty/imgui/imgui.cpp:10375

#1 0x00007ffff7cd0201 in ImGui::End () at /home/sakuray/Documents/MyTools/Sakuray-Engine/Sakuray/3rdparty/imgui/imgui.cpp:7857

#2 0x00007ffff7d7bef0 in ImGui::ShowDemoWindow (p_open=0x7ffff7e8b4b8 <Sakuray::ImguiLayer::OnUpdate()::show>) at /home/sakuray/Documents/MyTools/Sakuray-Engine/Sakuray/3rdparty/imgui/imgui_demo.cpp:634

#3 0x00007ffff7c506db in Sakuray::ImguiLayer::OnUpdate (this=0x5555557b2200) at /home/sakuray/Documents/MyTools/Sakuray-Engine/Sakuray/src/Tool/ImguiLayer.cpp:48

#4 0x00007ffff7bfef39 in Sakuray::Application::Run (this=0x5555556b4170) at /home/sakuray/Documents/MyTools/Sakuray-Engine/Sakuray/src/Core/Application.cpp:43

#5 0x0000555555638a5b in main (argc=1, argv=0x7fffffffd918) at /home/sakuray/Documents/MyTools/Sakuray-Engine/Engine/../Sakuray/include/Sakuray/Core/EntryPoint.h:29 but other key don't have the errors. GPT tells to me that Key 'A' has other logic in ImGui.

Screenshots/Video:

No response

Minimal, Complete and Verifiable Example code:

// Here's some code anyone can copy and paste to reproduce your issue
void ImguiLayer::OnUpdate(){
        ImGuiIO& io = ImGui::GetIO();
        Application &app = Application::Get();
        io.DisplaySize = ImVec2(app.GetWindow().GetWidth(), app.GetWindow().GetHeight());

        float time = (float)glfwGetTime();
        io.DeltaTime = m_Time > 0.0f ? (time - m_Time) : (1.0f / 60.0f);
        m_Time = time;

        ImGui_ImplGlfw_NewFrame();
        ImGui_ImplOpenGL3_NewFrame();
        ImGui::NewFrame();    

        static bool show = true;
        // The crash occurs here
        ImGui::ShowDemoWindow(&show);

        ImGui::Render();
        ImGui_ImplOpenGL3_RenderDrawData(ImGui::GetDrawData());
    }

SakurayYuzuru avatar May 18 '25 02:05 SakurayYuzuru

The line numbers in your call stack don't match the current revision, so unless you specify the exact revision you are using they don't help much to pinpoint a potential problem.

More importantly, please try a debug build with enabled assertions. That should already tell a lot more.

GamingMinds-DanielC avatar May 19 '25 09:05 GamingMinds-DanielC

Closing as lacking information. Please enable asserts and provide more details and we can happily reopen this. High chances that the issue is due to information that was omitted in the report.

ocornut avatar Jun 20 '25 13:06 ocornut