Wrap wl_resource_get_user_data into safer helper functions

This ensures we're not incorrectly casting a resource.

Fixes #628
This commit is contained in:
emersion 2018-02-13 23:48:46 +01:00
parent 71cba94e73
commit 392d54a35d
No known key found for this signature in database
GPG key ID: 0FDE7BE0E88F5E48
18 changed files with 474 additions and 213 deletions

View file

@ -742,7 +742,7 @@ static void xwm_handle_surface_id_message(struct wlr_xwm *xwm,
struct wl_resource *resource =
wl_client_get_object(xwm->xwayland->client, id);
if (resource) {
struct wlr_surface *surface = wl_resource_get_user_data(resource);
struct wlr_surface *surface = wlr_surface_from_resource(resource);
xsurface->surface_id = 0;
xwm_map_shell_surface(xwm, xsurface, surface);
} else {