mirror of
https://github.com/hyprwm/wlroots-hyprland.git
synced 2024-12-22 09:59:48 +01:00
scene_output_layout: Don't destroy output when output layout is destroyed
There were a couple of problems with this:
1. The behavior is unexpected. Typically objects in wlroots won't
also destroy objects that they depend on. For instance, wlr_scene_output
will not destroy the wlr_output when it's destroyed. It shouldn't be any
different for scene layouts.
2. This fixes a crash where because wlr_output_layout and wlr_scene_output
are both addons to wlr_output, we might get into a situation where
wl_list_for_each_safe might malfunction. See [1]
This means that the compositor needs to manually destroy the output
when they destroy the layout, hence ~breaking. Compositors can just
call `wlr_scene_output_destroy()` if they want to destroy both at the
same time.
[1] https://gitlab.freedesktop.org/wlroots/wlroots/-/merge_requests/4358#note_2106260
This reverts commit 1a731596c5
.
Co-authored-by: Kirill Primak <vyivel@eclair.cafe>
This commit is contained in:
parent
5fb0007e02
commit
e1e911d425
2 changed files with 6 additions and 10 deletions
|
@ -517,21 +517,19 @@ struct wlr_scene_output *wlr_scene_get_scene_output(struct wlr_scene *scene,
|
|||
/**
|
||||
* Attach an output layout to a scene.
|
||||
*
|
||||
* With an attached `wlr_scene_output_layout`, removing or repositioning an output in the output
|
||||
* layout will respectively remove or reposition a corresponding scene-graph output. When the output
|
||||
* layout is destroyed, scene-graph outputs which were attached to this helper will be destroyed.
|
||||
* The resulting scene output layout allows to synchronize the positions of scene
|
||||
* outputs with the positions of corresponding layout outputs.
|
||||
*
|
||||
* When adding an output to the output_layout, users must also create a `wlr_scene_output` and pass
|
||||
* it to wlr_scene_output_layout_add_output().
|
||||
* It is automatically destroyed when the scene or the output layout is destroyed.
|
||||
*/
|
||||
struct wlr_scene_output_layout *wlr_scene_attach_output_layout(struct wlr_scene *scene,
|
||||
struct wlr_output_layout *output_layout);
|
||||
|
||||
/**
|
||||
* Add an output to the scene, with its positioning defined by the output layout.
|
||||
* Add an output to the scene output layout.
|
||||
*
|
||||
* The `wlr_scene_output_layout` takes ownership of the `wlr_scene_output`, which will be destroyed
|
||||
* when either the `wlr_scene_output_layout` or the `wlr_output_layout_output` is destroyed.
|
||||
* When the layout output is repositioned, the scene output will be repositioned
|
||||
* accordingly.
|
||||
*/
|
||||
void wlr_scene_output_layout_add_output(struct wlr_scene_output_layout *sol,
|
||||
struct wlr_output_layout_output *lo, struct wlr_scene_output *so);
|
||||
|
|
|
@ -28,7 +28,6 @@ static void scene_output_layout_output_destroy(
|
|||
wl_list_remove(&solo->layout_output_destroy.link);
|
||||
wl_list_remove(&solo->scene_output_destroy.link);
|
||||
wl_list_remove(&solo->link);
|
||||
wlr_scene_output_destroy(solo->scene_output);
|
||||
free(solo);
|
||||
}
|
||||
|
||||
|
@ -43,7 +42,6 @@ static void scene_output_layout_output_handle_scene_output_destroy(
|
|||
struct wl_listener *listener, void *data) {
|
||||
struct wlr_scene_output_layout_output *solo =
|
||||
wl_container_of(listener, solo, scene_output_destroy);
|
||||
solo->scene_output = NULL;
|
||||
scene_output_layout_output_destroy(solo);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue