From 2a738803b2dfb45b5289540c31dacde56a04885c Mon Sep 17 00:00:00 2001 From: emersion Date: Mon, 18 Feb 2019 19:42:48 +0100 Subject: backend/drm: fix NULL dereference when unsetting cursor This segfault happens on multi-GPU systems. Fixes https://github.com/swaywm/sway/issues/3717 --- backend/drm/drm.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'backend/drm') diff --git a/backend/drm/drm.c b/backend/drm/drm.c index 635a78e2..e0eed4c2 100644 --- a/backend/drm/drm.c +++ b/backend/drm/drm.c @@ -720,9 +720,8 @@ static bool drm_connector_set_cursor(struct wlr_output *output, } struct gbm_bo *bo = plane->cursor_enabled ? plane->surf.back : NULL; - - if (drm->parent) { - bo = copy_drm_surface_mgpu(&plane->mgpu_surf, plane->surf.back); + if (bo && drm->parent) { + bo = copy_drm_surface_mgpu(&plane->mgpu_surf, bo); } if (bo) { -- cgit v1.2.3