-
-
Notifications
You must be signed in to change notification settings - Fork 10.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Reset ImGui::GetIO().BackendFlags on shutdown #6334
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. |
…ear BackendPlatformName. (ocornut#6334, ocornut#6335) Amended with fix for missing clear for ImGuiBackendFlags_HasGamepad.
, ocornut#6334) Co-authored-by: Alexander Rath <alex@ist.besonders.cool>
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()
: