diff options
author | Emil Velikov <[email protected]> | 2017-09-27 19:49:11 +0100 |
---|---|---|
committer | Emil Velikov <[email protected]> | 2017-10-13 12:56:12 +0100 |
commit | 0cfd6f6cfc9e90c12e4bad17dc47e7ce4cf1b9ac (patch) | |
tree | 0ab33d4839aaea458447865802ea1075a08e49a3 /src/egl/wayland/wayland-drm | |
parent | 872a373bc829b7eb6d94063023934b3713185d75 (diff) |
wayland-drm: use a copy of the wayland_drm_callbacks struct
The callbacks may be called even when they are no longer valid.
Say, the user is dlclose(ing) libEGL while the buffers are being
destroyed.
Cc: [email protected]
Signed-off-by: Emil Velikov <[email protected]>
Reviewed-by: Daniel Stone <[email protected]>
Tested-by: Derek Foreman <[email protected]>
Diffstat (limited to 'src/egl/wayland/wayland-drm')
-rw-r--r-- | src/egl/wayland/wayland-drm/wayland-drm.c | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/src/egl/wayland/wayland-drm/wayland-drm.c b/src/egl/wayland/wayland-drm/wayland-drm.c index 2e256aea6d5..0f0a2317c7e 100644 --- a/src/egl/wayland/wayland-drm/wayland-drm.c +++ b/src/egl/wayland/wayland-drm/wayland-drm.c @@ -47,7 +47,7 @@ struct wl_drm { char *device_name; uint32_t flags; - struct wayland_drm_callbacks *callbacks; + struct wayland_drm_callbacks callbacks; struct wl_buffer_interface buffer_interface; }; @@ -58,7 +58,7 @@ destroy_buffer(struct wl_resource *resource) struct wl_drm_buffer *buffer = wl_resource_get_user_data(resource); struct wl_drm *drm = buffer->drm; - drm->callbacks->release_buffer(drm->user_data, buffer); + drm->callbacks.release_buffer(drm->user_data, buffer); free(buffer); } @@ -97,7 +97,7 @@ create_buffer(struct wl_client *client, struct wl_resource *resource, buffer->offset[2] = offset2; buffer->stride[2] = stride2; - drm->callbacks->reference_buffer(drm->user_data, name, fd, buffer); + drm->callbacks.reference_buffer(drm->user_data, name, fd, buffer); if (buffer->driver_buffer == NULL) { wl_resource_post_error(resource, WL_DRM_ERROR_INVALID_NAME, @@ -189,7 +189,7 @@ drm_authenticate(struct wl_client *client, { struct wl_drm *drm = wl_resource_get_user_data(resource); - if (drm->callbacks->authenticate(drm->user_data, id) < 0) + if (drm->callbacks.authenticate(drm->user_data, id) < 0) wl_resource_post_error(resource, WL_DRM_ERROR_AUTHENTICATE_FAIL, "authenicate failed"); @@ -270,7 +270,7 @@ wayland_drm_init(struct wl_display *display, char *device_name, drm->display = display; drm->device_name = strdup(device_name); - drm->callbacks = callbacks; + drm->callbacks = *callbacks; drm->user_data = user_data; drm->flags = flags; |