[Xcb] [PATCH xcb/libxcb] Fatal error message when we close libX11 window application

Uli Schlachter psychon at znc.in
Fri Oct 21 05:05:16 PDT 2011


Am 21.10.2011 12:35, Arvind Umrao wrote:
> Fixes:https://bugs.freedesktop.org/show_bug.cgi?id=41443
>
> When we close any libX11 window application, we get fatal error.
> XIO:  fatal IO error 11 (Resource temporarily unavailable).
> Fatal error messages are strange and confusing to developers.
> Error is simply because we quit the application, without exiting
> while loop of XNextEvent. XCB should give same error messages as
> legacy libX11 were. In order to fix this issue, I have set right error
> number at xcb_connection_t::has_error.This xcb_connection_t::has_error
> will be passed to default io handler of libX11, This value could then
> be used to display corrrect error messages in default IO error
> handler of libX11.
>
> Signed-off-by: Arvind Umrao<arvind.umrao at oracle.com>
> ---
[snip]
> @@ -203,7 +204,7 @@ unsigned int xcb_send_request(xcb_connection_t *c, int flags, struct iovec *vect
>           }
>           else if(longlen>  xcb_get_maximum_request_length(c))
>           {
> -            _xcb_conn_shutdown(c);
> +            _xcb_conn_shutdown(c, CONN_ERROR);
>               return 0; /* server can't take this; maybe need BIGREQUESTS? */
>           }

Is this really "connection error for eg socktet errors, pipe errors and other 
stream errors"? This error is due to bugs in the application (e.g. tried to 
upload a too large image).

Could this get its own error code? Am I just talking bullshit here and this is 
fine as-is?

> diff --git a/src/xcbint.h b/src/xcbint.h
> index 096576c..1f37396 100644
> --- a/src/xcbint.h
> +++ b/src/xcbint.h
> @@ -51,6 +51,17 @@ enum lazy_reply_tag
>       LAZY_FORCED
>   };
>
> +enum xcb_conn_error_type
> +{
> +    /* xcb connection shutdown because of connection errors for eg socket errors, pipe errors and other stream errors. */
> +    CONN_ERROR = 1,
> +    /* xcb connection shutdown because of extension not sppported */
> +    CONN_CLOSED_EXT_NOTSUPPORTED,
> +    /* The Unix98 standard malloc(), calloc(), and realloc() error upon failure, for eg ENOMEM */
> +    CONN_CLOSED_MEMORY_INSUFFICIENT
> +    /* TBD: Add more error state here.*/
> +};
> +
>   #define XCB_PAD(i) (-(i)&  3)
>
>   #define XCB_SEQUENCE_COMPARE(a,op,b)	((int64_t) ((a) - (b)) op 0)

Could these be made public? A name sounds way better than "3"

Changing the return type of xcb_connection_has_error() isn't an option, thus 
these would have to be #defines.


Feel free to ignore the above, I don't get to decide anything anyway.

Uli


More information about the Xcb mailing list