Hi, I've updated my dear Imgui version to 1.62 from 1.50 and after I set up everything working, my program crashed and I figured io.IniFilename = NULL causes that.
I've read the documentation on imgui.cpp but I couldn't see anything. Is there anything new about disabling ini setting? Thanks
If there is a crash please provide a callstack and info about the crash. Thanks!
Solved with io.IniFilename = ""; instead of NULL
I don't understand how io.IniFilename = NULL; could possibly make imgui crash and I cannot reproduce it, so would appreciate details from you. If there is an issue on imgui side we should fix it. Thanks.
I've figured out, issue wasn't the NULL, the issue is; when I was using the old version, I was setting the io outside of any function.
like this and this was the issue but before I figured this was the issue I've move it upside of my io.IniFilename code and then changed NULL to blank quotes and finally I thought issue was solved with quotes but it wasn't.
In a nutshell, I have to init io before everytime I'm gonna use it in a function. I can't use it with only one init.
In a nutshell, I have to init io before everytime I'm gonna use it in a function. I can't use it with only one init.
Since 1.60 you can only access ImGui::GetIO() once you have created a Context, this is what the assert in GetIO() should have been telling you:
ImGuiIO& ImGui::GetIO()
{
IM_ASSERT(GImGui != NULL && "No current context. Did you call ImGui::CreateContext() or ImGui::SetCurrentContext()?");
return GImGui->IO;
}
If you want a global ImGuiIO& io when you can add a global ImGuiContext* ctx = ImGui::CreateContext() before the call to IO but make sure it only exists in 1 compilation unit (not in a header file).
Most helpful comment
Since 1.60 you can only access ImGui::GetIO() once you have created a Context, this is what the assert in GetIO() should have been telling you:
If you want a global
ImGuiIO& iowhen you can add a globalImGuiContext* ctx = ImGui::CreateContext()before the call to IO but make sure it only exists in 1 compilation unit (not in a header file).