[PATCH] client: check for error before prepare/read

Pekka Paalanen ppaalanen at gmail.com
Thu Aug 21 06:50:30 PDT 2014


On Tue,  5 Aug 2014 11:43:35 +0200
Marek Chalupa <mchqwerty at gmail.com> wrote:

> This prevents from blocking shown in one display test. Also, it
> makes sense to not proceed further in the code of these function
> when an error occurred.
> ---
>  src/wayland-client.c | 6 ++++++
>  1 file changed, 6 insertions(+)
> 
> diff --git a/src/wayland-client.c b/src/wayland-client.c
> index 68a91f6..f176dd4 100644
> --- a/src/wayland-client.c
> +++ b/src/wayland-client.c
> @@ -1183,6 +1183,9 @@ wl_display_read_events(struct wl_display *display)
>  {
>  	int ret;
>  
> +	if (display->last_error)
> +		return -1;
> +
>  	pthread_mutex_lock(&display->mutex);
>  
>  	ret = read_events(display);
> @@ -1229,6 +1232,9 @@ wl_display_prepare_read_queue(struct wl_display *display,
>  {
>  	int ret;
>  
> +	if (display->last_error)
> +		return -1;
> +
>  	pthread_mutex_lock(&display->mutex);
>  
>  	if (!wl_list_empty(&queue->event_list)) {

Yup, this looks good to me. I just want to merge the tests before this
one.

Very good work.


Thanks,
pq


More information about the wayland-devel mailing list