Skip to content

Commit 67ecc7d

Browse files
kennylevinsenemersion
authored andcommitted
Re-init renderer for all outputs on lost context
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. (cherry picked from commit c90cb37)
1 parent 0de35b3 commit 67ecc7d

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

sway/server.c

+2-2
Original file line numberDiff line numberDiff line change
@@ -204,8 +204,8 @@ static void handle_renderer_lost(struct wl_listener *listener, void *data) {
204204

205205
wlr_compositor_set_renderer(server->compositor, renderer);
206206

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

0 commit comments

Comments
 (0)