[Xcb] [PATCH 2/2] xcb_get_setup(): Never return NULL

Peter Harris pharris at opentext.com
Mon Aug 18 14:59:15 PDT 2014


On 2014-08-18 04:38, Uli Schlachter wrote:
> The documentation doesn't mention it and it's unlikely that a lot of code out
> there handles this case correctly. So, instead of returning NULL, let
> xcb_get_setup() return a pointer to a static, invalid, all-zero setup
> information structure.

This one I'm a little bit less certain about. It could cause some buggy
applications to print a nonsense error (eg. root window not found,
default screen not found) instead of crashing, which is not an improvement.

That said, the API is simpler if we can guarantee that xcb_get_setup()
always returns a valid pointer.

Reviewed-by: Peter Harris <pharris at opentext.com>

Peter Harris
-- 
               Open Text Connectivity Solutions Group
Peter Harris                    http://connectivity.opentext.com/
Research and Development        Phone: +1 905 762 6001
pharris at opentext.com            Toll Free: 1 877 359 4866


More information about the Xcb mailing list