You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I apologise if this is not MagnumImGuiIntegration problem but ImGui problem instead. I am not sure what is the exact cause of this problem so I have started here.
I am able to draw the ImGui with the custom font without issues. However when the _imgui falls out of scope (on program exit), ImGui tries to delete invalid memory.
The exact traceback:
MagnumImGuiIntegration-d.dll!FreeWrapper(void * ptr, void * user_data) Line 1065
MagnumImGuiIntegration-d.dll!ImGui::MemFree(void * ptr) Line 2966
MagnumImGuiIntegration-d.dll!ImFontAtlas::ClearInputData() Line 1462
MagnumImGuiIntegration-d.dll!ImFontAtlas::Clear() Line 1500
MagnumImGuiIntegration-d.dll!ImFontAtlas::~ImFontAtlas() Line 1452
[External Code]
MagnumImGuiIntegration-d.dll!IM_DELETE<ImFontAtlas>(ImFontAtlas * p) Line 1534
MagnumImGuiIntegration-d.dll!ImGui::Shutdown(ImGuiContext * context) Line 3570
MagnumImGuiIntegration-d.dll!ImGui::DestroyContext(ImGuiContext * ctx) Line 3035
MagnumImGuiIntegration-d.dll!Magnum::ImGuiIntegration::Context::~Context() Line 137
magnum-imgui.exe::ImGuiExample::~ImGuiExample()
Inside of the FreeWrapper it is trying to call free(); with pointer that comes from my exe. (Visual Studio reports that the address of the pointer belongs to the exe, not to the Magnum DLL.)
Workaround
It seems that if I add io.Fonts->ConfigData.clear(); before creating ImGuiIntegration::Context it works without issues. So I get the following:
I ran into this as well when adding a HiDPI-aware font for the WebGL version. According to the docs, it takes ownership of the memory by default and you have to explicitly tell it to not do that -- like this. In your case that would be (from the top of my head):
The problem
I apologise if this is not MagnumImGuiIntegration problem but ImGui problem instead. I am not sure what is the exact cause of this problem so I have started here.
I am following the ImGui example from here: https://doc.magnum.graphics/magnum/examples-imgui.html
I am trying to load a custom font from a ttf file. Had to slightly modify the original example below into the following:
I am able to draw the ImGui with the custom font without issues. However when the
_imgui
falls out of scope (on program exit), ImGui tries to delete invalid memory.The exact traceback:
Inside of the
FreeWrapper
it is trying to callfree();
with pointer that comes from my exe. (Visual Studio reports that the address of the pointer belongs to the exe, not to the Magnum DLL.)Workaround
It seems that if I add
io.Fonts->ConfigData.clear();
before creatingImGuiIntegration::Context
it works without issues. So I get the following:No memory corruption on exit. But why?
Additional info
OS: Windows 10
Compiler: Visual Studio 15 2017 Win64 (14.16.27023)
Configuration: Debug
Magnum integration version: Commit 31ccefc
ImGui version: Commit ocornut/imgui@79f7778
Haven't tried Linux or OSX
The text was updated successfully, but these errors were encountered: