From 36f627d0fadf1d00e45662359246dad9a40c7a7f Mon Sep 17 00:00:00 2001 From: Simon Ser Date: Fri, 20 Jan 2023 23:11:22 +0100 Subject: [PATCH] Check return value of wlr_renderer_begin() Since [1], wlr_renderer_begin() can fail. Check its return value and bail. This fixes an assertion error (when begin() fails and then we try to render something) after a GPU reset. [1]: https://gitlab.freedesktop.org/wlroots/wlroots/-/commit/a541c9510a4cf544313bc9b0503d75820b42444e --- sway/desktop/render.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/sway/desktop/render.c b/sway/desktop/render.c index 4d242bd7..2b7214c3 100644 --- a/sway/desktop/render.c +++ b/sway/desktop/render.c @@ -1044,7 +1044,9 @@ void output_render(struct sway_output *output, struct timespec *when, fullscreen_con = workspace->current.fullscreen; } - wlr_renderer_begin(renderer, wlr_output->width, wlr_output->height); + if (!wlr_renderer_begin(renderer, wlr_output->width, wlr_output->height)) { + return; + } if (debug.damage == DAMAGE_RERENDER) { int width, height;