Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

wl_list_remove leave wl_listener links invalid, not ffi.NULL #37

Merged
merged 1 commit into from
Feb 21, 2022

Conversation

m-col
Copy link
Collaborator

@m-col m-col commented Feb 20, 2022

A listener's link shouldn't be removed more than one time from the
signal's wl_list, but it can, and doing so leads to crashes. The
existing logic seems to imply that wl_list_remove leaves the link as a
NULL pointer, blocking subsequent removals. However, the Wayland docs
state "Note: This operation leaves elm [the link] in an invalid state.
" Instead of relying on that, we should set the object's pointer to
None and use that to block subsequent removals.

Also, the self.link attribute looks like forgotten code that should have been removed.

A listener's link shouldn't be removed more than one time from the
signal's wl_list, but it can, and doing so leads to crashes. The
existing logic seems to imply that `wl_list_remove` leaves the link as a
NULL pointer, blocking subsequent removals. However, the Wayland docs
state "Note: This operation leaves elm [the link] in an invalid state.
" Instead of relying on that, we should set the object's pointer to
`None` and use that to block subsequent removals.
Copy link
Owner

@flacjacket flacjacket left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice! Thanks for the fix.

@flacjacket flacjacket merged commit c538079 into flacjacket:main Feb 21, 2022
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants