aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJiDe Zhang <zccrs@live.com>2023-07-25 15:08:13 +0800
committerAlexander Orzechowski <alex@ozal.ski>2023-08-03 02:13:00 +0000
commit61903ed66beed175556101635e4936a9f51d74db (patch)
tree30b2cd1d34737063e9456b116d872ee03669e5a5
parentd40bcfe2c18f057f4bc324a81230f6ba2267db44 (diff)
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.
-rw-r--r--types/output/cursor.c4
-rw-r--r--types/wlr_cursor.c4
2 files changed, 2 insertions, 6 deletions
diff --git a/types/output/cursor.c b/types/output/cursor.c
index c2510896..4d0cc19a 100644
--- a/types/output/cursor.c
+++ b/types/output/cursor.c
@@ -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};
diff --git a/types/wlr_cursor.c b/types/wlr_cursor.c
index aca43bee..e1fabe5d 100644
--- a/types/wlr_cursor.c
+++ b/types/wlr_cursor.c
@@ -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;