[PATCH] Destroy resources when destroying input and output

Neil Roberts neil at linux.intel.com
Fri May 9 07:56:47 PDT 2014


Jason Ekstrand <jason at jlekstrand.net> writes:

> Most of the magic there is in allowing resources with no handler in
> libwayland-server. The patch would be about 4 lines. Right now,
> client-side wl_proxy objects are allowed to have a NULL implementation
> and there's no problem; server-side, this is not currently allowed. If
> we allowed this ten Neil's wl_resource_zombify would only have to set
> the destructor, and implementation to NULL. For that matter, we could
> just do that explicitly in weston and not add API for it.

Don't forget that we also want to ignore requests that have zombie
resources as arguments, not just if the resource is directly used as a
target of a request.

It looks like the client-side already has code to handle zombie objects
by putting a marker called WL_ZOMBIE_OBJECT in the ID map. Perhaps we
should use the same mechanism on the server side too.

If a zombie object is received in an event on the client side it looks
like wl_closure_lookup_objects just sets the proxy object to NULL. Is
that safe? Wouldn't the event handlers crash if they get a NULL resource
in an event?

If we can somehow make wl_closure_lookup_objects report when it finds a
zombie object we can make the upper layers just consume the event. We
could do this on both the client and side and the server side.

- Neil


More information about the wayland-devel mailing list