Reset ImGui::GetIO().BackendFlags on shutdown#6334
Reset ImGui::GetIO().BackendFlags on shutdown#6334GereonV wants to merge 5 commits intoocornut:masterfrom
Conversation
|
Hello, |
|
Hi, |
|
Hello, I think the changes are fine and correct but:
io.BackendFlags &= ~ImGuiBackendFlags_HasMouseCursors;
io.BackendFlags &= ~ImGuiBackendFlags_HasSetMousePos;Can be: io.BackendFlags &= ~(ImGuiBackendFlags_HasMouseCursors | ImGuiBackendFlags_HasSetMousePos);
As this is relatively easy I don't mind doing it on my side, but if you are interested in pushing this to make a neat PR be my guest :) |
Metal and OSX require `ImGui_Impl*_GetBackendData() != nullptr` during shutdown anyway so this is not a breaking change. Actually, before this PR there were potential `nullptr` derefs in the respective `ImGui_Impl*_DestroyBackendData()`s. This PR both prevents this and also resets `io.BackendRendererUserData`, `io.BackendRendererName` and `io.BackendFlags`.
a2374a9 to
7d40dd4
Compare
|
@ocornut I'm done. The branch name obviously isn't accurate anymore, because all backends that set I commited the changes for Metal and OSX separately because I wanted to comment on it in the commit message: it also |
|
I am happy to have contributed ^^ |
|
Also pushed 1f2b84a with equivalent flag clear for docking branch. |
) Co-authored-by: Alexander Rath <[email protected]>
Relevant code in
ImGui_ImplOpenGL3_Init():(Note: can always be reset, regardless of whether it was actually set on initialization)
Relevant code in
ImGui_ImplGlfw_Init():