libweston: fix crash on never used output's tear-down

weston_output_enable() initializes the list, but weston_output_release()
maybe be called even if the output was never enabled, triggering the
assert due to uninitialized (actually NULL) list head.

This can be triggered with a bad weston.ini, for example using an
invalid output transform value.

Check in weston_output_disable() instead, but because it too may be
called for non-enabled output, only if it was actually enabled.

Fixes: 1a4f87dec5
	"libweston: introduce weston_paint_node"

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
dev
Pekka Paalanen 3 years ago
parent 0750ceae6c
commit 2ec15ebf3f
  1. 7
      libweston/compositor.c

@ -6719,9 +6719,12 @@ weston_output_disable(struct weston_output *output)
if (output->disable(output) < 0)
return;
if (output->enabled)
if (output->enabled) {
weston_compositor_remove_output(output);
assert(wl_list_empty(&output->paint_node_list));
}
output->destroying = 0;
}
@ -6816,8 +6819,6 @@ weston_output_release(struct weston_output *output)
if (output->enabled)
weston_compositor_remove_output(output);
assert(wl_list_empty(&output->paint_node_list));
pixman_region32_fini(&output->region);
wl_list_remove(&output->link);

Loading…
Cancel
Save