mirror of
https://github.com/swaywm/sway.git
synced 2024-11-14 06:24:20 +01:00
Fix race condition crash when view unmaps + maps quickly
When a view unmaps, we start a transaction to destroy the container, then when the transaction completes we destroy the container and unset the view's container pointer. But if the view has remapped in the meantime, the view's container pointer will be pointing to a different container which should not be cleared. This adds a check to make sure the view is still pointing to the container being destroyed before clearing the pointer. The freeing of the title format is also removed as it is already freed when the view destroys in view_destroy.
This commit is contained in:
parent
c43374cdf0
commit
4e4898e90f
@ -67,12 +67,10 @@ void container_destroy(struct sway_container *con) {
|
|||||||
list_free(con->outputs);
|
list_free(con->outputs);
|
||||||
|
|
||||||
if (con->view) {
|
if (con->view) {
|
||||||
struct sway_view *view = con->view;
|
if (con->view->container == con) {
|
||||||
view->container = NULL;
|
con->view->container = NULL;
|
||||||
free(view->title_format);
|
}
|
||||||
view->title_format = NULL;
|
if (con->view->destroying) {
|
||||||
|
|
||||||
if (view->destroying) {
|
|
||||||
view_destroy(con->view);
|
view_destroy(con->view);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user