mirror of
https://github.com/hyprwm/wlroots-hyprland.git
synced 2024-11-22 12:55:58 +01:00
backend/multi: handle backends depending on each other properly
wl_list_for_each_safe only allows the current list item to be removed. If a backend destroys itself when another backend is destroyed, this blows up.
This commit is contained in:
parent
e3343cf7d1
commit
7720ce7827
1 changed files with 5 additions and 2 deletions
|
@ -49,8 +49,11 @@ static void multi_backend_destroy(struct wlr_backend *wlr_backend) {
|
|||
|
||||
wl_list_remove(&backend->display_destroy.link);
|
||||
|
||||
struct subbackend_state *sub, *next;
|
||||
wl_list_for_each_safe(sub, next, &backend->backends, link) {
|
||||
// Some backends may depend on other backends, ie. destroying a backend may
|
||||
// also destroy other backends
|
||||
while (!wl_list_empty(&backend->backends)) {
|
||||
struct subbackend_state *sub =
|
||||
wl_container_of(backend->backends.next, sub, link);
|
||||
wlr_backend_destroy(sub->backend);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue