[Xcb] [PATCH 3/3] Use WSAStartup()/WSACleanup() on WIN32

Jon TURNEY jon.turney at dronecode.org.uk
Fri Jan 6 09:24:18 PST 2012


On 06/01/2012 03:36, Josh Triplett wrote:
> On Thu, Jan 05, 2012 at 11:55:30PM +0200, Rémi Denis-Courmont wrote:
>> Le jeudi 5 janvier 2012 23:28:06 Josh Triplett, vous avez écrit :
>>> Or will Winsock just tell XCB to use the older version?
>>
>> If the version requested by XCB is not supported, WSAStartup() will fail. Note 
>> that there is a bug in the patch: XCB should never call WSACleanup() if 
>> WSAStartup() did not succeed.
> 
> I don't see how that case could happen in the patch you provided.

They should be matched by the fact that xcb_disconnect() can only be called
(once) on the xcb_connection_t produced by a successful xcb_connect*().

But because we don't check the result of WSAStartup(), they could be unmatched
if WSAStartup() fails, but the rest of xcb_connect_to_display_with_auth_info()
succeeds (perhaps because of a previous WSAStartup() with a supported winsock
version).

I shall update the patch so the result of  WSAStartup() is checked.


More information about the Xcb mailing list