aboutsummaryrefslogtreecommitdiff
path: root/xwayland
diff options
context:
space:
mode:
authorScott Moreau <oreaus@gmail.com>2019-12-31 02:46:27 -0700
committerDrew DeVault <sir@cmpwn.com>2019-12-31 08:07:16 -0700
commita9b1d9e83854eb589978e4d8bea9198f1198a45f (patch)
tree2bc2ed983a32eea74a97f048447d29836a86d661 /xwayland
parenta7b538008b85fac57eea8e6ac8903d50c8392a29 (diff)
xwayland: Clean up if Xwayland fails to start
When running wlroots compositors with Xwayland executable bits unset, if DISPLAY is set to the display number wlroots has set up, then X and gtk clients (at least) hang when they are ran. X clients should fail with an error and exit while gtk clients should fall back to wayland backend and run correctly. This is because wlroots opened sockets for Xwayland but wasn't closing them if Xwayland failed to start.
Diffstat (limited to 'xwayland')
-rw-r--r--xwayland/xwayland.c14
1 files changed, 10 insertions, 4 deletions
diff --git a/xwayland/xwayland.c b/xwayland/xwayland.c
index 2018d341..77698f44 100644
--- a/xwayland/xwayland.c
+++ b/xwayland/xwayland.c
@@ -219,18 +219,17 @@ static int xserver_handle_ready(int signal_number, void *data) {
continue;
}
wlr_log_errno(WLR_ERROR, "waitpid for Xwayland fork failed");
- return 1;
+ goto error;
}
if (stat_val) {
wlr_log(WLR_ERROR, "Xwayland startup failed, not setting up xwm");
- return 1;
+ goto error;
}
wlr_log(WLR_DEBUG, "Xserver is ready");
wlr_xwayland->xwm = xwm_create(wlr_xwayland);
if (!wlr_xwayland->xwm) {
- xwayland_finish_server(wlr_xwayland);
- return 1;
+ goto error;
}
if (wlr_xwayland->seat) {
@@ -254,6 +253,13 @@ static int xserver_handle_ready(int signal_number, void *data) {
wl_signal_init(&wlr_xwayland->events.ready);
return 1; /* wayland event loop dispatcher's count */
+error:
+ /* clean up */
+ wlr_xwayland_set_seat(wlr_xwayland, NULL);
+ xwayland_finish_server(wlr_xwayland);
+ xwayland_finish_display(wlr_xwayland);
+
+ return 1;
}
static int xwayland_socket_connected(int fd, uint32_t mask, void* data){