diff --git a/sway/desktop/xdg_shell.c b/sway/desktop/xdg_shell.c
index ce6fe41a..c84ca111 100644
--- a/sway/desktop/xdg_shell.c
+++ b/sway/desktop/xdg_shell.c
@@ -17,6 +17,7 @@
 #include "sway/tree/container.h"
 #include "sway/tree/view.h"
 #include "sway/tree/workspace.h"
+#include "sway/xdg_decoration.h"
 
 static const struct sway_view_child_impl popup_impl;
 
@@ -461,6 +462,9 @@ static void handle_destroy(struct wl_listener *listener, void *data) {
 	wl_list_remove(&xdg_shell_view->map.link);
 	wl_list_remove(&xdg_shell_view->unmap.link);
 	view->wlr_xdg_surface = NULL;
+	if (view->xdg_decoration) {
+		view->xdg_decoration->view = NULL;
+	}
 	view_begin_destroy(view);
 }
 
diff --git a/sway/xdg_decoration.c b/sway/xdg_decoration.c
index 39e0df56..9ac87191 100644
--- a/sway/xdg_decoration.c
+++ b/sway/xdg_decoration.c
@@ -10,7 +10,9 @@ static void xdg_decoration_handle_destroy(struct wl_listener *listener,
 		void *data) {
 	struct sway_xdg_decoration *deco =
 		wl_container_of(listener, deco, destroy);
-	deco->view->xdg_decoration = NULL;
+	if(deco->view) {
+		deco->view->xdg_decoration = NULL;
+	}
 	wl_list_remove(&deco->destroy.link);
 	wl_list_remove(&deco->request_mode.link);
 	wl_list_remove(&deco->link);