view: fix crash when a minimized fullscreen window closes

Do not call view methods after invalidating an invariant of the view
(view->scene_tree != NULL)
This commit is contained in:
bi4k8 2024-01-11 14:56:04 +00:00 committed by Johan Malm
parent e9023f51c6
commit 9d63c803d3

View file

@ -2030,11 +2030,6 @@ view_destroy(struct view *view)
osd_on_view_destroy(view);
undecorate(view);
if (view->scene_tree) {
wlr_scene_node_destroy(&view->scene_tree->node);
view->scene_tree = NULL;
}
/*
* The layer-shell top-layer is disabled when an application is running
* in fullscreen mode, so if that's the case, we may have to re-enable
@ -2054,6 +2049,16 @@ view_destroy(struct view *view)
menu_close_root(server);
}
/*
* Destroy the view's scene tree. View methods assume this is non-NULL,
* so we should avoid any calls to those between this and freeing the
* view.
*/
if (view->scene_tree) {
wlr_scene_node_destroy(&view->scene_tree->node);
view->scene_tree = NULL;
}
/* Remove view from server->views */
wl_list_remove(&view->link);
free(view);