Destroyed surfaces and focus events

Jason Ekstrand jason at jlekstrand.net
Mon Jun 17 08:12:49 PDT 2013


Hi All,
After looking into it a bit more, it appears as if the proper thing to do
is to allow a null surface in wl_pointer.leave, wl_keyboard.leave, etc.
Right now, that's what the clients are seeing anyway because
wl_surface_destroy destroys the associated proxy so there is no valid way
to call a wl_pointer.leave handler with a non-null surface.  Allowing that
argument to be null with a specific note about surface closing would make
how we handle it server-side irrelivant.

I'll send a protocol patch some time soon here.
--Jason Ekstrand


On Sat, Jun 15, 2013 at 3:34 PM, Jason Ekstrand <jason at jlekstrand.net>wrote:

> Hi All,
> This week, some of the wl_resource pointer changes that I made to weston
> caused a bug related to destroyed resources in keyboard/pointer focus
> handling.  This bug brings up an interesting protocol issue in how we
> should handle pointer focus with respect to resource destruction.
>
> The specific issue in the code is as follows.  Before, when a
> weston_surface got destroyed by wl_resourc_destroy, the wl_resource object
> was left more-or-less intact while the wl_resource.destroy_signal was
> fired.  In the new changes, the resource gets destroyed (and the pointer
> set to null) when that signal gets fired.  One of the things that happens
> due to that signal is firing a wl_pointer.leave event for the closed
> surface.  Due to the change, the wl_pointer.leave event is fired with a
> null surface (which causes weston to print a warning).  Also related is a
> possible segfault.
>
> This brings me to the protocol question.  Shoud we fire a wl_pointer.leave
> event for a surface if the pointer leaves because the client destroyed the
> surface?  In theory, the proxy object for the surface should have been
> destroyed before the client recieves the signal so we really can't handle
> it properly on the client-side anyway.  Most of the time this doesn't
> matter because all the demo clients are single-window, but for multi-window
> clients, it might be an issue if they only close one window.
>
> Once the protocol questions get answered, I'll fix the bug one way or the
> other.
>
> Thanks for your thoughts,
> --Jason Ekstrand
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/wayland-devel/attachments/20130617/4eccb29c/attachment.html>


More information about the wayland-devel mailing list