Reset ImGui::GetIO().BackendPlatformName in Android and GLUT shutdown #6335
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Android and GLUT backends set
io.BackendPlatformName
during initialization. These backends' shutdowns have previously been no-ops and hence failed to resetio.BackendPlatformName
. Because they don't useio.BackendPlatformUserData
onlyImGui::GetCurrentContext()
can be checked. Other backends check forImGui::GetCurrentContext() != nullptr
which also fails whenImGui::GetCurrentContext() == nullptr
and emit the same error message regardless of whether there was no context or no backend data. For this reason it's perfectly consistent to emit the same error message. Consideration about compatibility should be taken: programs may break when they relied on these backends' shutdown not failing. However arguably those could be considered misuses and additionally they'd need to have read the implementation ofImGui_Impl*_Shutdown
to reason about the safety of calling it out-of-place or multiple times. Having done that they probably wouldn't have called the shutdown function at all (because it didn't do anything). Furthermore, if someone's program breaks due to this change all it takes to exactly restore the old behavior is to not call the shutdown function.