<div dir="ltr"><div>Really, do we need a whole 30 seconds?  You can easily do enough interaction to crash something in 30 seconds.  Other than that, this looks fine.<br></div>Reviewed-by: Jason Ekstrand <<a href="mailto:jason.ekstrand@intel.com">jason.ekstrand@intel.com</a>><br>
</div><div class="gmail_extra"><br><br><div class="gmail_quote">On Thu, Aug 28, 2014 at 1:48 AM, Pekka Paalanen <span dir="ltr"><<a href="mailto:ppaalanen@gmail.com" target="_blank">ppaalanen@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">From: Pekka Paalanen <<a href="mailto:pekka.paalanen@collabora.co.uk">pekka.paalanen@collabora.co.uk</a>><br>
<br>
If weston-desktop-shell dies soon after launch, or maybe cannot be<br>
executed at all, let weston exit rather than letting the user stare at a<br>
black screen.<br>
<br>
But, do not exit weston, if weston-desktop-shell dies later, as the user<br>
may already have apps open, and those apps would likely still function<br>
correctly. This gives the user the opportunity to save his work and<br>
close the apps properly.<br>
<br>
This should make one class of "I see only black screen" failures obvious.<br>
<br>
Signed-off-by: Pekka Paalanen <<a href="mailto:pekka.paalanen@collabora.co.uk">pekka.paalanen@collabora.co.uk</a>><br>
---<br>
 desktop-shell/shell.c | 32 +++++++++++++++++++++++++++++++-<br>
 desktop-shell/shell.h |  3 +++<br>
 2 files changed, 34 insertions(+), 1 deletion(-)<br>
<br>
diff --git a/desktop-shell/shell.c b/desktop-shell/shell.c<br>
index c21d364..26f13cc 100644<br>
--- a/desktop-shell/shell.c<br>
+++ b/desktop-shell/shell.c<br>
@@ -5298,6 +5298,32 @@ shell_surface_configure(struct weston_surface *es, int32_t sx, int32_t sy)<br>
        }<br>
 }<br>
<br>
+static bool<br>
+check_desktop_shell_crash_too_early(struct desktop_shell *shell)<br>
+{<br>
+       struct timespec now;<br>
+<br>
+       if (clock_gettime(CLOCK_MONOTONIC, &now) < 0)<br>
+               return false;<br>
+<br>
+       /*<br>
+        * If the shell helper client dies before the session has been<br>
+        * up for roughly 30 seconds, better just make Weston shut down,<br>
+        * because the user likely has no way to interact with the desktop<br>
+        * anyway.<br>
+        */<br>
+       if (now.tv_sec - shell->startup_time.tv_sec < 30) {<br>
+               weston_log("Error: %s apparently cannot run at all.\n",<br>
+                          shell->client);<br>
+               weston_log_continue(STAMP_SPACE "Quitting...");<br>
+               wl_display_terminate(shell->compositor->wl_display);<br>
+<br>
+               return true;<br>
+       }<br>
+<br>
+       return false;<br>
+}<br>
+<br>
 static void launch_desktop_shell_process(void *data);<br>
<br>
 static void<br>
@@ -5340,7 +5366,9 @@ desktop_shell_client_destroy(struct wl_listener *listener, void *data)<br>
         * returning.<br>
         */<br>
<br>
-       respawn_desktop_shell_process(shell);<br>
+       if (!check_desktop_shell_crash_too_early(shell))<br>
+               respawn_desktop_shell_process(shell);<br>
+<br>
        shell_fade_startup(shell);<br>
 }<br>
<br>
@@ -6407,5 +6435,7 @@ module_init(struct weston_compositor *ec,<br>
<br>
        shell_fade_init(shell);<br>
<br>
+       clock_gettime(CLOCK_MONOTONIC, &shell->startup_time);<br>
+<br>
        return 0;<br>
 }<br>
diff --git a/desktop-shell/shell.h b/desktop-shell/shell.h<br>
index 67c5f50..2cfd1d6 100644<br>
--- a/desktop-shell/shell.h<br>
+++ b/desktop-shell/shell.h<br>
@@ -23,6 +23,7 @@<br>
  */<br>
<br>
 #include <stdbool.h><br>
+#include <time.h><br>
<br>
 #include "compositor.h"<br>
<br>
@@ -209,6 +210,8 @@ struct desktop_shell {<br>
        enum desktop_shell_panel_position panel_position;<br>
<br>
        char *client;<br>
+<br>
+       struct timespec startup_time;<br>
 };<br>
<br>
 struct weston_output *<br>
<span class="HOEnZb"><font color="#888888">--<br>
1.8.5.5<br>
<br>
_______________________________________________<br>
wayland-devel mailing list<br>
<a href="mailto:wayland-devel@lists.freedesktop.org">wayland-devel@lists.freedesktop.org</a><br>
<a href="http://lists.freedesktop.org/mailman/listinfo/wayland-devel" target="_blank">http://lists.freedesktop.org/mailman/listinfo/wayland-devel</a><br>
</font></span></blockquote></div><br></div>