mirror of
https://github.com/labwc/labwc.git
synced 2026-03-18 05:33:53 -04:00
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:
parent
81778a16bb
commit
4f8b80700e
9 changed files with 24 additions and 31 deletions
23
src/output.c
23
src/output.c
|
|
@ -128,17 +128,6 @@ handle_output_frame(struct wl_listener *listener, void *data)
|
|||
return;
|
||||
}
|
||||
|
||||
if (!output->scene_output) {
|
||||
/*
|
||||
* TODO: This is a short term fix for issue #1667,
|
||||
* a proper fix would require restructuring
|
||||
* the life cycle of scene outputs, e.g.
|
||||
* creating them on handle_new_output() only.
|
||||
*/
|
||||
wlr_log(WLR_INFO, "Failed to render new frame: no scene-output");
|
||||
return;
|
||||
}
|
||||
|
||||
if (output->gamma_lut_changed) {
|
||||
/*
|
||||
* We are not mixing the gamma state with
|
||||
|
|
@ -1062,8 +1051,14 @@ output_get_adjacent(struct output *output, enum lab_edge edge, bool wrap)
|
|||
bool
|
||||
output_is_usable(struct output *output)
|
||||
{
|
||||
/* output_is_usable(NULL) is safe and returns false */
|
||||
return output && output->wlr_output->enabled;
|
||||
/*
|
||||
* output_is_usable(NULL) is safe and returns false.
|
||||
*
|
||||
* Checking output->scene_output != NULL is necessary in case the
|
||||
* wlr_output was initially enabled but hasn't been configured yet
|
||||
* (occurs with autoEnableOutputs=no).
|
||||
*/
|
||||
return output && output->wlr_output->enabled && output->scene_output;
|
||||
}
|
||||
|
||||
/* returns true if usable area changed */
|
||||
|
|
@ -1123,7 +1118,7 @@ output_update_all_usable_areas(struct server *server, bool layout_changed)
|
|||
struct wlr_box
|
||||
output_usable_area_in_layout_coords(struct output *output)
|
||||
{
|
||||
if (!output) {
|
||||
if (!output_is_usable(output)) {
|
||||
return (struct wlr_box){0};
|
||||
}
|
||||
struct wlr_box box = output->usable_area;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue