viewporter: fix "has buffer" check

Previously, cases when a viewport source box was updated without attaching
a buffer weren't checked for correctness properly because the state's buffer
would be NULL. Use wlr_surface_state_has_buffer() instead.
This commit is contained in:
Kirill Primak 2024-03-23 23:33:14 +03:00 committed by Simon Zeni
parent 538a7a190d
commit 072f6ed977

View File

@ -158,7 +158,7 @@ static void viewport_handle_surface_client_commit(struct wl_listener *listener,
return; return;
} }
if (state->viewport.has_src && state->buffer != NULL && if (state->viewport.has_src && wlr_surface_state_has_buffer(state) &&
!check_src_buffer_bounds(state)) { !check_src_buffer_bounds(state)) {
wlr_surface_reject_pending(viewport->surface, wlr_surface_reject_pending(viewport->surface,
viewport->resource, WP_VIEWPORT_ERROR_OUT_OF_BUFFER, viewport->resource, WP_VIEWPORT_ERROR_OUT_OF_BUFFER,