[PATCH wayland-protocols v2] Add zwp_linux_explicit_synchronization_v1

Alexandros Frantzis alexandros.frantzis at collabora.com
Wed Oct 31 11:16:42 UTC 2018


On Wed, Oct 31, 2018 at 11:59:34AM +0200, Pekka Paalanen wrote:
> On Mon, 15 Oct 2018 17:16:59 +0300
> Alexandros Frantzis <alexandros.frantzis at collabora.com> wrote:

...

> > 
> > The main scenario is an early exit from some code using this
> > object, in which case it will be easier to correctly synchronize proper
> > destruction of any user data used by the zwp_buffer_release_v1 listener,
> > when having an explicit destroy request.
> > 
> > This isn't particular to this protocol though, it's a general
> > (theoretical) concern of mine with the destroy-on-event pattern.  But if
> > this has worked well for wp_presentation_feedback, perhaps it's not a big
> > deal.
> 
> Hi Alf,
> 
> I'm not sure what you mean with that concern.
> 
> When an event destroys a protocol object, the compositor will
> unconditionally destroy the wl_resource right after sending the event.
> That means the server-side request listener cannot receive any messages
> anymore, so any user data would be destroyed at the same time anyway.
> 
> On client side, regardless of whether there is destroy request or not,
> the client will destroy the wl_proxy. The request would only let the
> compositor know that the protocol object is no more. Regardless of a
> destroy request, the client side will automatically ignore any events
> to the destroyed wl_proxy. That ignoring is what makes client initiated
> object destruction safe in the first place.
> 
> When the client destroys the wl_proxy, it can also free any user data
> associated with it, because that will guarantee that the listeners
> cannot be called anymore.
> 
> If we have a destructor event, and the client destroys the wl_proxy
> before that event is sent, then the event will simply be ignored. Once
> the compositor sends the event, then both client and compositor again
> agree that the protocol object no longer exists.
> 
> wl_display has a "secret" event that tells libwayland-client when the
> server has destroyed the protocol object, which makes all the above
> work.
> 
> 
> Thanks,
> pq

Hi Pekka,

thanks for the detailed explanation. I was misunderstanding how
destroy-on-event is expected to work.

I'll update the protocol to use destroy-on-event in v5.

Thanks,
Alexandros


More information about the wayland-devel mailing list