fix crash when a minimized window closes

e.g., open an editor from a terminal, minimize it, then hit ^C in the terminal

simply don't unmap xdg or xwayland views if they are not currently marked as mapped
This commit is contained in:
bi4k8 2021-12-11 23:24:44 +00:00 committed by ARDiDo
parent 730a642bea
commit 3a29e436e5
2 changed files with 13 additions and 9 deletions

View file

@ -364,12 +364,14 @@ xdg_toplevel_view_map(struct view *view)
static void static void
xdg_toplevel_view_unmap(struct view *view) xdg_toplevel_view_unmap(struct view *view)
{ {
if (view->mapped) {
view->mapped = false; view->mapped = false;
damage_all_outputs(view->server); damage_all_outputs(view->server);
wl_list_remove(&view->commit.link); wl_list_remove(&view->commit.link);
wl_list_remove(&view->new_subsurface.link); wl_list_remove(&view->new_subsurface.link);
desktop_focus_topmost_mapped_view(view->server); desktop_focus_topmost_mapped_view(view->server);
} }
}
static const struct view_impl xdg_toplevel_view_impl = { static const struct view_impl xdg_toplevel_view_impl = {
.configure = xdg_toplevel_view_configure, .configure = xdg_toplevel_view_configure,

View file

@ -279,11 +279,13 @@ map(struct view *view)
static void static void
unmap(struct view *view) unmap(struct view *view)
{ {
if(view->mapped) {
view->mapped = false; view->mapped = false;
damage_all_outputs(view->server); damage_all_outputs(view->server);
wl_list_remove(&view->commit.link); wl_list_remove(&view->commit.link);
desktop_focus_topmost_mapped_view(view->server); desktop_focus_topmost_mapped_view(view->server);
} }
}
static void static void
maximize(struct view *view, bool maximized) maximize(struct view *view, bool maximized)