From 87d3b61355cf742f8ac1270c3f4e38ded9501de7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kristian=20H=C3=B8gsberg?= Date: Sun, 19 Jan 2014 21:48:10 -0800 Subject: [PATCH] shell: Don't start a fade animation if we don't have an output When the last window of the X11 compositor is closed during a fade or while locked, we'll try to start a fade back to the lock screen. However, if we closed the last window, there are no outputs left and the animation will try to run with surface->output == NULL. https://bugs.freedesktop.org/show_bug.cgi?id=73665 --- desktop-shell/shell.c | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/desktop-shell/shell.c b/desktop-shell/shell.c index 71610cca..c27ccc70 100644 --- a/desktop-shell/shell.c +++ b/desktop-shell/shell.c @@ -4412,13 +4412,22 @@ shell_fade(struct desktop_shell *shell, enum fade_type type) weston_view_update_transform(shell->fade.view); } - if (shell->fade.animation) + if (shell->fade.view->output == NULL) { + /* If the black view gets a NULL output, we lost the + * last output and we'll just cancel the fade. This + * happens when you close the last window under the + * X11 or Wayland backends. */ + shell->locked = false; + weston_surface_destroy(shell->fade.view->surface); + shell->fade.view = NULL; + } else if (shell->fade.animation) { weston_fade_update(shell->fade.animation, tint); - else + } else { shell->fade.animation = weston_fade_run(shell->fade.view, 1.0 - tint, tint, 300.0, shell_fade_done, shell); + } } static void