summaryrefslogtreecommitdiff
path: root/src/cairo-xcb-connection-shm.c
diff options
context:
space:
mode:
authorUli Schlachter <psychon@znc.in>2021-05-02 17:49:32 +0200
committerUli Schlachter <psychon@znc.in>2021-05-02 17:49:32 +0200
commitc16094fc443c076475c4633d83d6e67539cf423e (patch)
treeb76b827bb3df0cd95c055c083b04a0091e59acc9 /src/cairo-xcb-connection-shm.c
parent4f61b765c9f657fd755194afe576e56f945af4b6 (diff)
downloadcairo-c16094fc443c076475c4633d83d6e67539cf423e.tar.gz
xcb: Remove free XID cache
cairo-xcb kept a cache of free xid to avoid calling xcb_generate_id() later. However, this is unsafe: When libxcb runs out of ids, it asks the X11 server for an empty range of ids to use. The X11 server of course does not know about cairo's cache and could hand out an id that cairo will use again later. This would then result in BadIdChoice errors later. Fix this by simply removing the whole cache. Fixes: https://gitlab.freedesktop.org/cairo/cairo/-/issues/434 Signed-off-by: Uli Schlachter <psychon@znc.in>
Diffstat (limited to 'src/cairo-xcb-connection-shm.c')
-rw-r--r--src/cairo-xcb-connection-shm.c3
1 files changed, 1 insertions, 2 deletions
diff --git a/src/cairo-xcb-connection-shm.c b/src/cairo-xcb-connection-shm.c
index 7720bbbd2..140a73cd0 100644
--- a/src/cairo-xcb-connection-shm.c
+++ b/src/cairo-xcb-connection-shm.c
@@ -43,7 +43,7 @@ _cairo_xcb_connection_shm_attach (cairo_xcb_connection_t *connection,
uint32_t id,
cairo_bool_t readonly)
{
- uint32_t segment = _cairo_xcb_connection_get_xid (connection);
+ uint32_t segment = xcb_generate_id (connection->xcb_connection);
assert (connection->flags & CAIRO_XCB_HAS_SHM);
xcb_shm_attach (connection->xcb_connection, segment, id, readonly);
return segment;
@@ -109,7 +109,6 @@ _cairo_xcb_connection_shm_detach (cairo_xcb_connection_t *connection,
{
assert (connection->flags & CAIRO_XCB_HAS_SHM);
xcb_shm_detach (connection->xcb_connection, segment);
- _cairo_xcb_connection_put_xid (connection, segment);
}
#endif /* CAIRO_HAS_XCB_SHM_FUNCTIONS */