diff --git a/desktop-shell/shell.c b/desktop-shell/shell.c
index 430660f6c32bf4520b97b932ee2d33eace696efd..69e7246415b0a8591739e6bc157d69cd189bf5f1 100644
--- a/desktop-shell/shell.c
+++ b/desktop-shell/shell.c
@@ -2165,7 +2165,7 @@ desktop_surface_removed(struct weston_desktop_surface *desktop_surface,
 	weston_desktop_surface_set_user_data(shsurf->desktop_surface, NULL);
 	shsurf->desktop_surface = NULL;
 
-	if (weston_surface_is_mapped(surface) &&
+	if (weston_view_is_mapped(shsurf->view) &&
 	    shsurf->shell->win_close_animation_type == ANIMATION_FADE) {
 
 		if (shsurf->shell->compositor->state == WESTON_COMPOSITOR_ACTIVE &&