[PATCH] Fix for segmentation fault due to outdated list link pointers

Jonas Ådahl jadahl at gmail.com
Thu Oct 20 12:38:44 PDT 2011


Hi,

Attached you will find two patches (one for wayland.git and one for
wayland-demos.git) that fixes some crashes I've seen.

The reason has been that after a surface destroyed listener gets
called, its link is not reset. This may result memory corruption
(specifically in resource destroyed listener lists) and segmentation
faults due to some code may try to remove a link from freed memory or
memory that has been allocated for something else.

The patches solves the problem by calling wl_init(struct wl_list
*list) in the callbacks at appropriate times. One could argue that it
would be simpler to have the callee to clean up the links but that
would make it impossible to have the callback create a new list
connection. I tried to find all the callback functions for the
resource destroyed listener to reset the link, but it's possible that
I could have missed some. Any feedback is welcome.

Jonas Ådahl
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-wayland-server-Clean-up-the-destroyed-listener-link-.patch
Type: text/x-patch
Size: 1450 bytes
Desc: not available
URL: <http://lists.freedesktop.org/archives/wayland-devel/attachments/20111020/de3ff03c/attachment.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-Clean-up-the-destroyed-listener-link.patch
Type: text/x-patch
Size: 4389 bytes
Desc: not available
URL: <http://lists.freedesktop.org/archives/wayland-devel/attachments/20111020/de3ff03c/attachment-0001.bin>


More information about the wayland-devel mailing list