Backends: avoid null dereference in metal and osx shutdown#6385
Merged
ocornut merged 1 commit intoocornut:masterfrom May 4, 2023
Merged
Backends: avoid null dereference in metal and osx shutdown#6385ocornut merged 1 commit intoocornut:masterfrom
ocornut merged 1 commit intoocornut:masterfrom
Conversation
Contributor
Author
|
(For reference: #6334 is the original PR that introduced the offending commit) |
Owner
|
Apologies for overlooking this, thank you for the fix! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
A recent change (7d40dd4) is causing a null pointer dereference on shutdown in the metal backend. This is because
ImGui_ImplMetal_DestroyDeviceObjectstries to accessBackendRendererUserData, which is set tonullptrbefore its execution. This PR changes the order so that the objects are destroyed before the pointer is set to null. Similarly, this PR fixes a memory leak on shutdown in the osx backend, where the pointer is also set to null beforeIM_DELETEis called. I have looked whether 7d40dd4 introduces issues in other backends as well, but metal and osx seem to be the only ones affected. Thanks!