Destroyed surfaces and focus events

Jason Ekstrand jason at jlekstrand.net
Sat Jun 15 13:34:03 PDT 2013


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/20130615/3dce7b92/attachment.html>


More information about the wayland-devel mailing list