summaryrefslogtreecommitdiff
path: root/src/cairo-xcb-connection-core.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-core.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-core.c')
-rw-r--r--src/cairo-xcb-connection-core.c6
1 files changed, 2 insertions, 4 deletions
diff --git a/src/cairo-xcb-connection-core.c b/src/cairo-xcb-connection-core.c
index e01dc1a83..df6e2febd 100644
--- a/src/cairo-xcb-connection-core.c
+++ b/src/cairo-xcb-connection-core.c
@@ -42,7 +42,7 @@ _cairo_xcb_connection_create_pixmap (cairo_xcb_connection_t *connection,
uint16_t width,
uint16_t height)
{
- xcb_pixmap_t pixmap = _cairo_xcb_connection_get_xid (connection);
+ xcb_pixmap_t pixmap = xcb_generate_id (connection->xcb_connection);
assert (width > 0);
assert (height > 0);
@@ -57,7 +57,6 @@ _cairo_xcb_connection_free_pixmap (cairo_xcb_connection_t *connection,
xcb_pixmap_t pixmap)
{
xcb_free_pixmap (connection->xcb_connection, pixmap);
- _cairo_xcb_connection_put_xid (connection, pixmap);
}
xcb_gcontext_t
@@ -66,7 +65,7 @@ _cairo_xcb_connection_create_gc (cairo_xcb_connection_t *connection,
uint32_t value_mask,
uint32_t *values)
{
- xcb_gcontext_t gc = _cairo_xcb_connection_get_xid (connection);
+ xcb_gcontext_t gc = xcb_generate_id (connection->xcb_connection);
xcb_create_gc (connection->xcb_connection, gc, drawable,
value_mask, values);
return gc;
@@ -77,7 +76,6 @@ _cairo_xcb_connection_free_gc (cairo_xcb_connection_t *connection,
xcb_gcontext_t gc)
{
xcb_free_gc (connection->xcb_connection, gc);
- _cairo_xcb_connection_put_xid (connection, gc);
}
void