diff options
| author | Furkan Sahin <furkan-dev@proton.me> | 2024-10-02 15:55:17 +0200 |
|---|---|---|
| committer | Furkan Sahin <furkan-dev@proton.me> | 2024-10-02 15:55:17 +0200 |
| commit | 408c18b9efb61d2128bc2ea582588c74e913f740 (patch) | |
| tree | 87374b246ac08d7365b732037c5ff70f927fca68 | |
| parent | 2196889f895d9f28b736806b8da46fbe90b6f0fd (diff) | |
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 c90cb37b2a0861548461daa9b75d75317e01b679)
| -rw-r--r-- | sway/server.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/sway/server.c b/sway/server.c index 9648f258..7c17fdf1 100644 --- a/sway/server.c +++ b/sway/server.c @@ -204,8 +204,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); } |
