wayland: Notes for future readers on use of get_window_with_id and window->terminated.#59
Merged
fredkiefer merged 1 commit intognustep:masterfrom Jul 28, 2025
Conversation
…ndow->terminated.
fredkiefer
approved these changes
Jul 28, 2025
Contributor
|
@ivucica indeed |
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.
wayland: Notes for future readers on use of get_window_with_id and window->terminated.
@fredkiefer as maintainer (and perhaps @nongio + @slp as code authors):
Can you please take a closer look at what might be happening here? I don't have a wayland setup to actually build and test this, so I just tried to follow the logic. An automated tool wrote a little note that this
free(window)might cause a free-after-use, but I don't think it can (even though that is absolutely not clear when I just try to read the code).Separately,
get_window_with_idcan return a NULL, yet most callsites seem to pretend it can't. I suspect it actually won't be returning NULL in practice, because the window that's gone from local structures will not even be told about -- unless Wayland is similarly asynchronous as X11. Or if the calling functions have bugs.So, perhaps callers of
get_window_with_idshould deal with it returning NULL. What do you think?