[PATCH weston] xwayland: Clean up the WM properly if X server crashes

Pekka Paalanen ppaalanen at gmail.com
Wed Aug 27 04:50:46 PDT 2014


On Thu, 19 Jun 2014 01:03:31 -0700
Dima Ryazanov <dima at gmail.com> wrote:

> 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 at gmail.com>
> ---
>  xwayland/launcher.c | 6 ++++--
>  1 file changed, 4 insertions(+), 2 deletions(-)
> 
> diff --git a/xwayland/launcher.c b/xwayland/launcher.c
> index 70703a4..fad6219 100644
> --- a/xwayland/launcher.c
> +++ b/xwayland/launcher.c
> @@ -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;
> @@ -159,8 +159,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;
>  }
>  

Hi,

good catch! This means that the wm cleanup was *never* run, because
wxs->wm as inited to NULL, and never set again.

This patch even removes the following error when exiting weston:

(EE) 
Fatal server error:
(EE) failed to dispatch Wayland events: Broken pipe
(EE) 

Pushed.


Thanks,
pq


More information about the wayland-devel mailing list