Fix segfault in DRM cursor

This commit is contained in:
Drew DeVault 2017-10-28 15:09:38 -04:00
parent 4281aefbf8
commit fa9c6ecc53
1 changed files with 7 additions and 7 deletions

View File

@ -503,13 +503,6 @@ static bool wlr_drm_connector_set_cursor(struct wlr_output *output,
struct wlr_drm_crtc *crtc = conn->crtc; struct wlr_drm_crtc *crtc = conn->crtc;
struct wlr_drm_plane *plane = crtc->cursor; struct wlr_drm_plane *plane = crtc->cursor;
if (!buf && update_pixels) {
// Hide the cursor
plane->cursor_enabled = false;
return drm->iface->crtc_set_cursor(drm, crtc, NULL);
}
plane->cursor_enabled = true;
// We don't have a real cursor plane, so we make a fake one // We don't have a real cursor plane, so we make a fake one
if (!plane) { if (!plane) {
plane = calloc(1, sizeof(*plane)); plane = calloc(1, sizeof(*plane));
@ -520,6 +513,13 @@ static bool wlr_drm_connector_set_cursor(struct wlr_output *output,
crtc->cursor = plane; crtc->cursor = plane;
} }
if (!buf && update_pixels) {
// Hide the cursor
plane->cursor_enabled = false;
return drm->iface->crtc_set_cursor(drm, crtc, NULL);
}
plane->cursor_enabled = true;
if (!plane->surf.gbm) { if (!plane->surf.gbm) {
int ret; int ret;
uint64_t w, h; uint64_t w, h;