mirror of
https://github.com/labwc/labwc.git
synced 2026-03-13 05:33:47 -04:00
chase wlroots: wlr_xwayland_set_cursor now takes a wlr_buffer
Ref: 84d603acc06a45dd3c3a4b2cf1fd08b2933ca2b5 (xwayland: take wlr_buffer in wlr_xwayland_set_cursor()) Ref: 6ae54dca23064e897b393283887986e5719a747f (xwayland: lock new buffer instead of the old one) Co-Authored-By: Consolatis This wlroots change fixes a potential UAF which we dealt with in labwc. We can thus remove the workaround completely.
This commit is contained in:
parent
e7fae789ab
commit
777b6a718e
4 changed files with 6 additions and 60 deletions
|
|
@ -75,8 +75,6 @@ void xwayland_adjust_usable_area(struct view *view,
|
||||||
|
|
||||||
void xwayland_update_workarea(struct server *server);
|
void xwayland_update_workarea(struct server *server);
|
||||||
|
|
||||||
void xwayland_reset_cursor(struct server *server);
|
|
||||||
|
|
||||||
void xwayland_flush(struct server *server);
|
void xwayland_flush(struct server *server);
|
||||||
|
|
||||||
#endif /* HAVE_XWAYLAND */
|
#endif /* HAVE_XWAYLAND */
|
||||||
|
|
|
||||||
|
|
@ -1610,9 +1610,6 @@ void
|
||||||
cursor_reload(struct seat *seat)
|
cursor_reload(struct seat *seat)
|
||||||
{
|
{
|
||||||
cursor_load(seat);
|
cursor_load(seat);
|
||||||
#if HAVE_XWAYLAND
|
|
||||||
xwayland_reset_cursor(seat->server);
|
|
||||||
#endif
|
|
||||||
cursor_update_image(seat);
|
cursor_update_image(seat);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1200,60 +1200,11 @@ xwayland_server_init(struct server *server, struct wlr_compositor *compositor)
|
||||||
server->seat.xcursor_manager, XCURSOR_DEFAULT, 1);
|
server->seat.xcursor_manager, XCURSOR_DEFAULT, 1);
|
||||||
if (xcursor) {
|
if (xcursor) {
|
||||||
struct wlr_xcursor_image *image = xcursor->images[0];
|
struct wlr_xcursor_image *image = xcursor->images[0];
|
||||||
wlr_xwayland_set_cursor(server->xwayland, image->buffer,
|
struct wlr_buffer *cursor_buffer = wlr_xcursor_image_get_buffer(image);
|
||||||
image->width * 4, image->width,
|
if (cursor_buffer) {
|
||||||
image->height, image->hotspot_x,
|
wlr_xwayland_set_cursor(server->xwayland, cursor_buffer,
|
||||||
image->hotspot_y);
|
image->hotspot_x, image->hotspot_y);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
xwayland_reset_cursor(struct server *server)
|
|
||||||
{
|
|
||||||
/*
|
|
||||||
* As xwayland caches the pixel data when not yet started up
|
|
||||||
* due to the delayed lazy startup approach, we do have to
|
|
||||||
* re-set the xwayland cursor image. Otherwise the first X11
|
|
||||||
* client connected will cause the xwayland server to use
|
|
||||||
* the cached (and potentially destroyed) pixel data.
|
|
||||||
*
|
|
||||||
* Calling this function after reloading the cursor theme
|
|
||||||
* ensures that the cached pixel data keeps being valid.
|
|
||||||
*
|
|
||||||
* To reproduce:
|
|
||||||
* - Compile with b_sanitize=address,undefined
|
|
||||||
* - Start labwc (nothing in autostart that could create
|
|
||||||
* a X11 connection, e.g. no GTK or X11 application)
|
|
||||||
* - Reconfigure
|
|
||||||
* - Start some X11 client
|
|
||||||
*/
|
|
||||||
|
|
||||||
if (!server->xwayland) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
struct wlr_xcursor *xcursor = wlr_xcursor_manager_get_xcursor(
|
|
||||||
server->seat.xcursor_manager, XCURSOR_DEFAULT, 1);
|
|
||||||
|
|
||||||
if (xcursor && !server->xwayland->xwm) {
|
|
||||||
/* Prevents setting the cursor on an active xwayland server */
|
|
||||||
struct wlr_xcursor_image *image = xcursor->images[0];
|
|
||||||
wlr_xwayland_set_cursor(server->xwayland, image->buffer,
|
|
||||||
image->width * 4, image->width,
|
|
||||||
image->height, image->hotspot_x,
|
|
||||||
image->hotspot_y);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (server->xwayland->cursor) {
|
|
||||||
/*
|
|
||||||
* The previous configured theme has set the
|
|
||||||
* default cursor or the xwayland server is
|
|
||||||
* currently running but still has a cached
|
|
||||||
* xcursor set that will be used on the next
|
|
||||||
* xwayland destroy -> lazy startup cycle.
|
|
||||||
*/
|
|
||||||
zfree(server->xwayland->cursor);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
[wrap-git]
|
[wrap-git]
|
||||||
url = https://gitlab.freedesktop.org/wlroots/wlroots.git
|
url = https://gitlab.freedesktop.org/wlroots/wlroots.git
|
||||||
revision = 06275103f249cd2954630e59383342e102a6c1a3
|
revision = 6ae54dca23064e897b393283887986e5719a747f
|
||||||
|
|
||||||
[provide]
|
[provide]
|
||||||
dependency_names = wlroots-0.20
|
dependency_names = wlroots-0.20
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue