Skip to content

Commit

Permalink
Re-init renderer for all outputs on lost context
Browse files Browse the repository at this point in the history
sway_root.outputs only include enabled outputs. We also need to re-init
the renderer for any disabled outputs, so use sway_root.all_outputs
instead.

Resolves the following heap-use-after-free accessing the render formats
when a disabled output is modeset after a GPU reset has occurred.
  • Loading branch information
kennylevinsen authored and Nefsen402 committed Oct 3, 2024
1 parent 9a9be01 commit c90cb37
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions sway/server.c
Original file line number Diff line number Diff line change
Expand Up @@ -205,8 +205,8 @@ static void handle_renderer_lost(struct wl_listener *listener, void *data) {

wlr_compositor_set_renderer(server->compositor, renderer);

for (int i = 0; i < root->outputs->length; ++i) {
struct sway_output *output = root->outputs->items[i];
struct sway_output *output;
wl_list_for_each(output, &root->all_outputs, link) {
wlr_output_init_render(output->wlr_output,
server->allocator, server->renderer);
}
Expand Down

0 comments on commit c90cb37

Please sign in to comment.