backend/drm: fix segfault in page_flip_handler

Since 5b1b43c68c ("backend/drm: make wlr_drm_plane.{pending,queued,current}_fb
pointers"), current_fb can be NULL if there's no buffer. If current_fb
is not NULL, current_fb->wlr_buf is guaranteed to not be NULL.

Closes: https://github.com/swaywm/wlroots/issues/2634
This commit is contained in:
Simon Ser 2021-01-12 11:41:45 +01:00
parent 3f7e0cf5f0
commit 5d054258af
No known key found for this signature in database
GPG key ID: 0FDE7BE0E88F5E48

View file

@ -1484,7 +1484,7 @@ static void page_flip_handler(int fd, unsigned seq,
* data between the GPUs, even if we were using the direct scanout * data between the GPUs, even if we were using the direct scanout
* interface. * interface.
*/ */
if (!drm->parent && plane->current_fb->wlr_buf && if (!drm->parent && plane->current_fb &&
wlr_client_buffer_get(plane->current_fb->wlr_buf)) { wlr_client_buffer_get(plane->current_fb->wlr_buf)) {
present_flags |= WLR_OUTPUT_PRESENT_ZERO_COPY; present_flags |= WLR_OUTPUT_PRESENT_ZERO_COPY;
} }