tree-wide: do not try to use outputs with no scene_output

- check for valid scene_output in output_is_usable()
- change many "output != NULL" checks to use output_is_usable()
- remove one now-redundant separate check for valid scene_output

Fixes a crash at startup (with autoEnableOutputs=no) due to
dereferencing null scene_output in create_output_config() since:

7d7ece21d9
("output: suppress error when output position is unavailable")

Fixes: #3357
This commit is contained in:
John Lindgren 2026-02-04 10:31:06 -05:00 committed by Johan Malm
parent 81778a16bb
commit 4f8b80700e
9 changed files with 24 additions and 31 deletions

View file

@ -145,7 +145,7 @@ try_to_focus_next_layer_or_toplevel(struct server *server)
{
struct seat *seat = &server->seat;
struct output *output = output_nearest_to_cursor(server);
if (!output) {
if (!output_is_usable(output)) {
goto no_output;
}
@ -589,16 +589,14 @@ handle_new_layer_surface(struct wl_listener *listener, void *data)
struct wlr_layer_surface_v1 *layer_surface = data;
if (!layer_surface->output) {
struct wlr_output *output = wlr_output_layout_output_at(
server->output_layout, server->seat.cursor->x,
server->seat.cursor->y);
if (!output) {
struct output *output = output_nearest_to_cursor(server);
if (!output_is_usable(output)) {
wlr_log(WLR_INFO,
"No output available to assign layer surface");
wlr_layer_surface_v1_destroy(layer_surface);
return;
}
layer_surface->output = output;
layer_surface->output = output->wlr_output;
}
struct lab_layer_surface *surface = znew(*surface);