aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJason Francis <cycl0ps@tuta.io>2019-07-27 19:34:09 -0400
committerSimon Ser <contact@emersion.fr>2019-08-01 19:00:48 +0300
commitd20aee6c9de12c8949b4ce7775b53dbc5f3896a6 (patch)
treecf04fb84baa841feb011cebf8117789b3cab6177
parent724b5e1b8d742a8429f4431ae1a55d7d26cb92ae (diff)
export-dmabuf-v1: fix segfault on output disable
-rw-r--r--types/wlr_export_dmabuf_v1.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/types/wlr_export_dmabuf_v1.c b/types/wlr_export_dmabuf_v1.c
index 4519350e..80efbdaa 100644
--- a/types/wlr_export_dmabuf_v1.c
+++ b/types/wlr_export_dmabuf_v1.c
@@ -34,9 +34,11 @@ static void frame_destroy(struct wlr_export_dmabuf_frame_v1 *frame) {
if (frame == NULL) {
return;
}
- wlr_output_lock_attach_render(frame->output, false);
- if (frame->cursor_locked) {
- wlr_output_lock_software_cursors(frame->output, false);
+ if (frame->output != NULL) {
+ wlr_output_lock_attach_render(frame->output, false);
+ if (frame->cursor_locked) {
+ wlr_output_lock_software_cursors(frame->output, false);
+ }
}
wl_list_remove(&frame->link);
wl_list_remove(&frame->output_precommit.link);
@@ -112,7 +114,7 @@ static void manager_handle_capture_output(struct wl_client *client,
wl_list_insert(&manager->frames, &frame->link);
- if (!output->impl->export_dmabuf) {
+ if (output == NULL || !output->enabled || !output->impl->export_dmabuf) {
zwlr_export_dmabuf_frame_v1_send_cancel(frame->resource,
ZWLR_EXPORT_DMABUF_FRAME_V1_CANCEL_REASON_PERMANENT);
frame_destroy(frame);