[PATCH] Destroy resources when destroying input and output
Neil Roberts
neil at linux.intel.com
Fri May 9 06:33:58 PDT 2014
Perhaps we should consider applying the patch anyway even though it's
not ideal. Currently if a client uses a dead output in a request such as
xdg_surface.set_output Weston will end up with a weston_output pointer
that points to freed memory. This could cause the compositor to crash.
That is worse than the alternative provided by this patch which is to
make the client abort. The clients know about the output being destroyed
via the wl_registry.global_remove event so in practice they would only
hit the problem in the unlikely event that they used the output in a
request in the short time between the output being unplugged and
noticing the removal event.
In the longer term I was thinking maybe it would be good to handle the
inert resource idea within libwayland-server. We could add a function
like wl_resource_zombify() which would mark the resource as a zombie and
call the destroy handlers. From the compositor's perspective it can then
act as if the resource has been destroyed. We could detect zombie
resources being used within the request marshalling code and ignore the
request. If the request creates new resource we can internally create
new zombie resources too and Weston would never need to know about it. I
am planning to experiment with this approach now.
Regards,
- Neil
More information about the wayland-devel
mailing list