-
Notifications
You must be signed in to change notification settings - Fork 62
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
wl: Check wl_surface before use it #669
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This fix is not 100% ideal: compositors are not allowed to pass NULL
surfaces for these events, because the protocol definition does not have the allow-null="true"
attribute for the surface parameter.
In theory we should read pending events before destroying surfaces, to ensure we don't have any left for them, but in practice that fix would be more complicated. Also, I have seen similar fixes in other projects (like glfw/glfw#1191) so I think we can go with the approach suggested in this PR for now.
Please remove the g_warning()
calls before merging, though.
Yes, for this reason I am handling this with a warning message because, to me,it is like a buggy implementation is the Wayland compositor more like an issue in the Cog side.
One idea it could handle this with a listener for the wl_surface destruction
but the key here is that the pointer|touch|... event handlers are actually associated to the Wayland Seat and we are using the same handlers for all the wl_surfaces from different Views. Actually we rely on the wl_surface object passed as argument to get the CogView attached to it. |
@psaavedra I think it's not worth it to bother with the destroy listener, let's merge this as-is. Maybe changing warnings into a comment—but I won't insist much on it. IMO there is nothing wrong with deciding that our code handles the |
... on pointer_on_enter, touch_on_down and keyboard_on_enter. It can be possible a situation during the destruction of a CogView where the UI-process were receiving and trying to process an input event for a non existant wl_surface. Under this scenario, the wl_surface associated could be not longer accesible so the input handler will receive a null-pointer (0x0). Backtrace: ``` 0 0xb9999999 in wl_proxy_get_user_data (proxy=proxy@entry=0x0) at ../wayland/src/wayland-client.c:2135 at /usr/include/wayland-client-protocol.h:3393 fixed_x=0, fixed_y=5, surface=0x0 <<<< , data=0xa9999999) ```
3369bd2
to
c13ffe9
Compare
OK. Let's do it then. |
... on pointer_on_enter, touch_on_down and keyboard_on_enter.
It can be possible a situation during the destruction of a CogView where the UI-process were receiving and trying to process an input event for a non existant wl_surface.
Under this scenario, the wl_surface associated could be not longer accesible so the input handler will receive a null-pointer (0x0).
Backtrace: