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.
master
JiDe Zhang 1 year ago committed by Alexander Orzechowski
parent d40bcfe2c1
commit 61903ed66b

@ -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, 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_buffer *buffer, int32_t hotspot_x, int32_t hotspot_y) {
struct wlr_renderer *renderer = cursor->output->renderer; struct wlr_renderer *renderer = cursor->output->renderer;
if (!renderer) { assert(renderer != NULL);
return false;
}
struct wlr_texture *texture = NULL; struct wlr_texture *texture = NULL;
struct wlr_fbox src_box = {0}; struct wlr_fbox src_box = {0};

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

Loading…
Cancel
Save