Skip to content

Assert when shutting down and recreating backend #2769

Closed

Description

@metarutaiga

Version/Branch of Dear ImGui:

Version: 1.73
Branch: viewport

Back-end/Renderer/Compiler/OS

Back-ends: imgui_impl_win32.cpp
Compiler: msvc_v142
Operating System: win10

My Issue/Question:

I implement a graphic library that it can change APIs in runtime.
But it always assert when recreating imgui.
I modified it below, but it's not a good method.
Has any good idea to resolve this assert?

Standalone, minimal, complete and verifiable example:
-- ImGuiViewport* main_viewport = ImGui::GetMainViewport();
++ ImGuiViewportP* main_viewport = (ImGuiViewportP*)ImGui::GetMainViewport();
++ main_viewport->PlatformWindowCreated = true;

Activity

  1. ocornut commented on Aug 29, 2019

    @ocornut
    Owner

    Please:

    • Actually specify WHAT is asserting, including a callstack. You haven't mentioned what the assert is.
    • Provide a repro or pseudo code to explain what you are doing.

    TL;DR; we need more context please.

  2. metarutaiga commented on Aug 29, 2019

    @metarutaiga
    Author

    My recreating method :
    ImGui_ImplXX_Shutdown();
    ImGui_ImplWin32_Shutdown();
    ImGui_ImplWin32_Init(hWnd);
    ImGui_ImplXX_Init(g_instance, 0, g_device);

    I don't run ImGui::DestroyContext(); / ImGui::CreateContext();
    And the PlatformWindowCreated of main-viewport is initialized in ImGui::CreateContext(); only.
    So it would be assert the problem.

    x1
    x2

  3. changed the title [-]Assert when recreating imgui [/-] [+]Assert when shutting down and recreating backend[/+] on Aug 29, 2019
  4. kudaba commented on Aug 30, 2019

    @kudaba
    Contributor

    I think you're hitting the crash that I fixed here: #2698, at least I think you're using the vulkan backend, you should include that in reports.

  5. ocornut commented on Sep 17, 2019

    @ocornut
    Owner

    Pushed a fix for this issue.
    Ideally we may want this field to be set/cleared by the platform back-end. We'll probably refactor this when working on #2471.

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

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions

      ⌂ 换网址