diff options
author | Ryan Pavlik <rpavlik@iastate.edu> | 2012-01-11 18:06:50 +0100 |
---|---|---|
committer | Julien Danjou <julien@danjou.info> | 2012-01-11 18:07:12 +0100 |
commit | 31b57676e8d7ab6048dbfb145187833fac5e478c (patch) | |
tree | ed63d3cbea86581cff154f9e226200b8281f394f /src/xcb_conn.c | |
parent | 0e9246def562be97cc816f824f702233a826ec56 (diff) |
Use WSAStartup()/WSACleanup() on WIN32
The alternative is to use these in every WIN32 application which uses xcb. Doing
it this way should be safe, as, according to MSDN, "There must be a call to
WSACleanup for each successful call to WSAStartup. Only the final WSACleanup
function call performs the actual cleanup. The preceding calls simply decrement
an internal reference count"
(We should probably also include ws2_32 in Libs.private for libxcb, as anything
which links with libxcb will also need that, but there seems to be some pkg-config
issues to resolve first...)
v2: Check for errors so WSAStartup()/WSACleanup() uses are balanced
v3: Use same indentation style as surrounding code
Reviewed-by: Peter Harris <pharris@opentext.com>
Signed-off-by: Julien Danjou <julien@danjou.info>
Diffstat (limited to 'src/xcb_conn.c')
-rw-r--r-- | src/xcb_conn.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/src/xcb_conn.c b/src/xcb_conn.c index f79de33..725502a 100644 --- a/src/xcb_conn.c +++ b/src/xcb_conn.c @@ -315,6 +315,10 @@ void xcb_disconnect(xcb_connection_t *c) _xcb_xid_destroy(c); free(c); + +#ifdef _WIN32 + WSACleanup(); +#endif } /* Private interface */ |