fix: crash when moving tabbed container to scratchpad (#182)

when `scratchpad_minimize` enabled
This commit is contained in:
RAR27 2023-06-02 20:19:25 -04:00 committed by GitHub
parent 15bf6ae835
commit 6a6cf2841c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -57,12 +57,15 @@ void root_destroy(struct sway_root *root) {
/* Set minimized state from scratchpad container `show` state */ /* Set minimized state from scratchpad container `show` state */
static void root_scratchpad_set_minimize(struct sway_container *con, bool minimize) { static void root_scratchpad_set_minimize(struct sway_container *con, bool minimize) {
struct wlr_foreign_toplevel_handle_v1 *foreign_toplevel = con->view->foreign_toplevel; if (con->view) {
if (wlr_surface_is_xwayland_surface(con->view->surface)) { struct wlr_foreign_toplevel_handle_v1 *foreign_toplevel = con->view->foreign_toplevel;
struct wlr_xwayland_surface *xsurface = wlr_xwayland_surface_from_wlr_surface(con->view->surface);
wlr_xwayland_surface_set_minimized(xsurface, minimize); if (wlr_surface_is_xwayland_surface(con->view->surface)) {
} else if (foreign_toplevel) { struct wlr_xwayland_surface *xsurface = wlr_xwayland_surface_from_wlr_surface(con->view->surface);
wlr_foreign_toplevel_handle_v1_set_minimized(foreign_toplevel, minimize); wlr_xwayland_surface_set_minimized(xsurface, minimize);
} else if (foreign_toplevel) {
wlr_foreign_toplevel_handle_v1_set_minimized(foreign_toplevel, minimize);
}
} }
} }