<div dir="ltr"><div><div><div><div>Hi All,<br></div>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.<br>
<br></div>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.<br>
<br>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.<br>
<br></div><div>Once the protocol questions get answered, I'll fix the bug one way or the other.<br></div><div><br></div>Thanks for your thoughts,<br></div>--Jason Ekstrand<br></div>