flacjacket / pywayland

Python bindings for the libwayland library
Apache License 2.0
79 stars 16 forks source link

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

Closed m-col closed 2 years ago

m-col commented 2 years ago

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.