arnaud-jamin / Cog

Cog is a set of debug tools for Unreal Engine built on top of Dear ImGui
MIT License
357 stars 44 forks source link

Project crashes when using RestartLevel console command #7

Closed infinstarlight closed 1 year ago

infinstarlight commented 1 year ago

I use the RestartLevel command often when debugging BPs and such in my project.

Unable to find a log with more specific info so here are the offending lines per the CrashReporter.

`Unhandled Exception: EXCEPTION_ACCESS_VIOLATION 0x0000000100000002

UnrealEditor_CogWindow!UCogWindowManager::Render() [C:\ISS_COS\ProjectLion\Plugins\Cog\Source\CogWindow\Private\CogWindowManager.cpp:110] UnrealEditor_CogImgui!SCogImguiWidget::TickImGui() [C:\ISS_COS\ProjectLion\Plugins\Cog\Source\CogImgui\Private\CogImguiWidget.cpp:100]`

CogWindowManager

` for (UCogWindow* Window : Windows) { Window->RenderTick(DeltaTime);

    if (Window->GetIsVisible() && bHideAllWindows == false)
    {
        if (bTransparentMode)
        {
            ImGui::SetNextWindowBgAlpha(0.35f);
        }

        ImGui::DockSpaceOverViewport(0, ImGuiDockNodeFlags_PassthruCentralNode | ImGuiDockNodeFlags_NoDockingInCentralNode | ImGuiDockNodeFlags_AutoHideTabBar);
        Window->Render(DeltaTime);
    }
}`

CogImguiWidget

ImGui::NewFrame(); Render(InDeltaTime); ImGui::Render();

arnaud-jamin commented 1 year ago

Do you have the same crash in the sample or only in your project ? If in your project, where did you add and tick the CogWindowManager ?

infinstarlight commented 1 year ago

I haven't tried it outside of my own project, I will try ASAP.

infinstarlight commented 1 year ago

So the sample project crashes as well. CogWindowManager.cpp at line 108 and CogImguiWidget.cpp at line 100

arnaud-jamin commented 1 year ago

Ok I can reproduce it. I first tried in Editor, but the command only works in package. Will investigate. Thanks!

arnaud-jamin commented 1 year ago

This should be fixed by this commit: https://github.com/arnaud-jamin/Cog/commit/4c9f73147583d925bc59d64820198c88edec900e