diff options
author | Derek Foreman <derek.foreman@collabora.com> | 2024-04-03 10:40:54 -0500 |
---|---|---|
committer | Derek Foreman <derek.foreman@collabora.com> | 2024-04-23 09:50:14 -0500 |
commit | b3f115dfc0cab82f36b7dbd39d1c9c0b27ae74d8 (patch) | |
tree | b4f1346de60b743f1ce72e3768e1dc5f76d4872b | |
parent | 25d8eb6b5ab24672486a00b1568f8789b589e080 (diff) |
libweston: Move plane stack/release for output primary_plane
It doesn't make sense to stack the plane before it's useful - so only
put it in the compositor's plane list on output_enable. The opposite of
weston_output_enable is weston_compositor_remove_output, so release the
plane there.
This stops a crash when closing one of multiple windows for a nested
backend results in the output being freed while the plane is still on the
compositor's plane list.
Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
-rw-r--r-- | libweston/compositor.c | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/libweston/compositor.c b/libweston/compositor.c index a73b91f7..93a1ef4c 100644 --- a/libweston/compositor.c +++ b/libweston/compositor.c @@ -7412,6 +7412,8 @@ weston_compositor_remove_output(struct weston_output *output) assert(output->destroying); assert(output->enabled); + weston_plane_release(&output->primary_plane); + if (output->idle_repaint_source) { wl_event_source_remove(output->idle_repaint_source); output->idle_repaint_source = NULL; @@ -7825,8 +7827,6 @@ weston_output_init(struct weston_output *output, wl_list_init(&output->mode_list); weston_plane_init(&output->primary_plane, compositor); - weston_compositor_stack_plane(compositor, - &output->primary_plane, NULL); /* Set the stock sRGB color profile for the output. Libweston users are * free to set the color profile to whatever they want later on. */ @@ -7981,12 +7981,19 @@ weston_output_enable(struct weston_output *output) output->capture_info = weston_output_capture_info_create(); assert(output->capture_info); + /* Backends want to stack planes on top of the primary, + * so we'd better set this up now. + */ + weston_compositor_stack_plane(output->compositor, + &output->primary_plane, NULL); + /* Enable the output (set up the crtc or create a * window representing the output, set up the * renderer, etc) */ if (output->enable(output) < 0) { weston_log("Enabling output \"%s\" failed.\n", output->name); + weston_plane_release(&output->primary_plane); weston_output_color_outcome_destroy(&output->color_outcome); weston_output_capture_info_destroy(&output->capture_info); return -1; @@ -8246,8 +8253,6 @@ weston_compositor_create_output(struct weston_compositor *compositor, WL_EXPORT void weston_output_destroy(struct weston_output *output) { - weston_plane_release(&output->primary_plane); - output->destroy(output); } |