[Bf-blender-cvs] [d7971972fa9] blender-v3.4-release: GHOST/Wayland: call exit() when Wayland has a fatal error

Campbell Barton noreply at git.blender.org
Mon Nov 14 00:37:37 CET 2022


Commit: d7971972fa9b43d7bff5477ced8bae3cc383387e
Author: Campbell Barton
Date:   Mon Nov 14 10:28:23 2022 +1100
Branches: blender-v3.4-release
https://developer.blender.org/rBd7971972fa9b43d7bff5477ced8bae3cc383387e

GHOST/Wayland: call exit() when Wayland has a fatal error

Without this, a fatal error simply floods the stderr with the same
message without exiting.

Also add note on why reconnecting to the display server isn't practical.

===================================================================

M	intern/ghost/intern/GHOST_SystemWayland.cpp

===================================================================

diff --git a/intern/ghost/intern/GHOST_SystemWayland.cpp b/intern/ghost/intern/GHOST_SystemWayland.cpp
index 123534502fb..3e45eb5904b 100644
--- a/intern/ghost/intern/GHOST_SystemWayland.cpp
+++ b/intern/ghost/intern/GHOST_SystemWayland.cpp
@@ -66,6 +66,7 @@
 #include <sys/mman.h>
 #include <unistd.h>
 
+#include <cstdlib> /* For `exit`. */
 #include <cstring>
 #include <mutex>
 
@@ -1171,6 +1172,19 @@ static void ghost_wl_display_report_error(struct wl_display *display)
   else {
     fprintf(stderr, "The Wayland connection experienced a fatal error: %s\n", strerror(ecode));
   }
+
+  /* NOTE(@campbellbarton): The application is running,
+   * however an error closes all windows and most importantly:
+   * shuts down the GPU context (loosing all GPU state - shaders, bind codes etc),
+   * so recovering from this effectively involves restarting.
+   *
+   * Keeping the GPU state alive doesn't seem to be supported as windows EGL context must use the
+   * same connection as the used for all other WAYLAND interactions (see #wl_display_connect).
+   * So in practice re-connecting to the display server isn't an option.
+   *
+   * Exit since leaving the process open will simply flood the output and do nothing.
+   * Although as the process is in a valid state, auto-save for e.g. is possible, see: T100855. */
+  ::exit(-1);
 }
 
 /**



More information about the Bf-blender-cvs mailing list