wlr_output_cursor: assert renderer isn't NULL

When a wlr_output add to wlr_output_layout, wlr_cursor will create
wlr_buffer of xcursor for the wlr_output, this behavior depends
wlr_renderer of wlr_output, using assert to ensure renderer is
initialized before wlr_output_layout_add and wlr_cursor_set_buffer/
wlr_cursor_set_xcursor.
This commit is contained in:
JiDe Zhang 2023-07-25 15:08:13 +08:00 committed by Alexander Orzechowski
parent d40bcfe2c1
commit 61903ed66b
2 changed files with 2 additions and 6 deletions

View file

@ -394,9 +394,7 @@ static bool output_cursor_attempt_hardware(struct wlr_output_cursor *cursor) {
bool wlr_output_cursor_set_buffer(struct wlr_output_cursor *cursor,
struct wlr_buffer *buffer, int32_t hotspot_x, int32_t hotspot_y) {
struct wlr_renderer *renderer = cursor->output->renderer;
if (!renderer) {
return false;
}
assert(renderer != NULL);
struct wlr_texture *texture = NULL;
struct wlr_fbox src_box = {0};

View file

@ -509,9 +509,7 @@ static void cursor_output_cursor_update(struct wlr_cursor_output_cursor *output_
if (cur->state->buffer != NULL) {
struct wlr_renderer *renderer = output_cursor->output_cursor->output->renderer;
if (!renderer) {
return;
}
assert(renderer != NULL);
struct wlr_buffer *buffer = cur->state->buffer;
int32_t hotspot_x = cur->state->buffer_hotspot.x;