xwayland: Clean up the WM properly if X server crashes
authorDima Ryazanov <dima@gmail.com>
Thu, 19 Jun 2014 08:03:31 +0000 (01:03 -0700)
committerPekka Paalanen <pekka.paalanen@collabora.co.uk>
Wed, 27 Aug 2014 11:49:16 +0000 (14:49 +0300)
The X cleanup code uses wxs->wm to check if the WM has been created - but that
variable was never initialized. So if X crashes, the WM doesn't get destroyed,
causing a crash when it tries to repaint a window.

Signed-off-by: Dima Ryazanov <dima@gmail.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
xwayland/launcher.c

index bf1e17e..df2efd2 100644 (file)
@@ -43,7 +43,7 @@ handle_sigusr1(int signal_number, void *data)
        /* We'd be safer if we actually had the struct
         * signalfd_siginfo from the signalfd data and could verify
         * this came from Xwayland.*/
-       weston_wm_create(wxs, wxs->wm_fd);
+       wxs->wm = weston_wm_create(wxs, wxs->wm_fd);
        wl_event_source_remove(wxs->sigusr1_source);
 
        return 1;
@@ -163,8 +163,10 @@ weston_xserver_shutdown(struct weston_xserver *wxs)
        }
        close(wxs->abstract_fd);
        close(wxs->unix_fd);
-       if (wxs->wm)
+       if (wxs->wm) {
                weston_wm_destroy(wxs->wm);
+               wxs->wm = NULL;
+       }
        wxs->loop = NULL;
 }