Skip to content

wayland: Notes for future readers on use of get_window_with_id and window->terminated.#59

Merged
fredkiefer merged 1 commit intognustep:masterfrom
ivucica:ivucica-wayland-fixes-2
Jul 28, 2025
Merged

wayland: Notes for future readers on use of get_window_with_id and window->terminated.#59
fredkiefer merged 1 commit intognustep:masterfrom
ivucica:ivucica-wayland-fixes-2

Conversation

@ivucica
Copy link
Member

@ivucica ivucica commented Jul 28, 2025

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_id can 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_id should deal with it returning NULL. What do you think?

@ivucica ivucica requested a review from nongio July 28, 2025 00:25
@ivucica ivucica requested a review from fredkiefer as a code owner July 28, 2025 00:25
@fredkiefer fredkiefer merged commit bc7a4c2 into gnustep:master Jul 28, 2025
3 checks passed
@nongio
Copy link
Contributor

nongio commented Jul 28, 2025

@ivucica indeed get_window_with_id can return NULL, being a lookup by an integer ID
thanks for updating the documentation

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

3 participants