[PATCH 2/2] window: Make a roundtrip to ensure globals have been enumerated.

Pekka Paalanen ppaalanen at gmail.com
Wed May 14 01:14:57 PDT 2014


On Tue, 13 May 2014 22:54:36 +0200
Paul Liétar <paul at lietar.net> wrote:

> If the compositor enumerates the globals too slowly, the d->sum pointer
> is still NULL by the time create_cursors is called, and leads to a null
> pointer dereferencing.
> 
> A roundtrip is needed to make sure all globals have been enumerated.
> 
> Signed-off-by: Paul Liétar <paul at lietar.net>
> ---
>  clients/window.c | 6 +++++-
>  1 file changed, 5 insertions(+), 1 deletion(-)
> 
> diff --git a/clients/window.c b/clients/window.c
> index 7b77f93..f52d2bc 100644
> --- a/clients/window.c
> +++ b/clients/window.c
> @@ -5320,10 +5320,14 @@ display_create(int *argc, char *argv[])
>  	d->registry = wl_display_get_registry(d->display);
>  	wl_registry_add_listener(d->registry, &registry_listener, d);
>  
> -	if (wl_display_dispatch(d->display) < 0) {
> +	if (wl_display_roundtrip(d->display) < 0) {
>  		fprintf(stderr, "Failed to process Wayland connection: %m\n");
>  		return NULL;
>  	}
> +	if (d->shm == NULL) {
> +		fprintf(stderr, "No wl_shm global\n");
> +		return NULL;
> +	}
>  
>  #ifdef HAVE_CAIRO_EGL
>  	if (init_egl(d) < 0)

Hi

Looks good! This is 1.5-stable stuff, and probably for all earlier
stable branches, too.

Excellent find, already proves that working on a middle-man dumper is
useful. :-) In fact, adding a mode to the dumper program, where it will
delay every single relayed message by at least 20 ms (longer than
monitor refresh period) after the previous message would probably
expose more racy stuff to fix.

I don't see the patch 1/2 for simple-touch though. Did it not reach the
mailing list?


Thanks,
pq


More information about the wayland-devel mailing list