xwayland: Check buffer prior to attaching it
If the buffer is NULL, do not even try to attach it, and risk a Wayland protocol error which would be fatal to us. Signed-off-by: Olivier Fourdan <ofourdan@redhat.com> Reviewed-by: Martin Peres <martin.peres@mupuf.org> Reviewed-by: Michel Dänzer <mdaenzer@redhat.com> https://gitlab.freedesktop.org/xorg/xserver/-/issues/1156
This commit is contained in:
parent
4f0889e983
commit
25d2f4948f
|
@ -162,8 +162,15 @@ static void
|
||||||
xwl_cursor_attach_pixmap(struct xwl_seat *xwl_seat,
|
xwl_cursor_attach_pixmap(struct xwl_seat *xwl_seat,
|
||||||
struct xwl_cursor *xwl_cursor, PixmapPtr pixmap)
|
struct xwl_cursor *xwl_cursor, PixmapPtr pixmap)
|
||||||
{
|
{
|
||||||
wl_surface_attach(xwl_cursor->surface,
|
struct wl_buffer *buffer;
|
||||||
xwl_shm_pixmap_get_wl_buffer(pixmap), 0, 0);
|
|
||||||
|
buffer = xwl_shm_pixmap_get_wl_buffer(pixmap);
|
||||||
|
if (!buffer) {
|
||||||
|
ErrorF("cursor: Error getting buffer\n");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
wl_surface_attach(xwl_cursor->surface, buffer, 0, 0);
|
||||||
xwl_surface_damage(xwl_seat->xwl_screen, xwl_cursor->surface, 0, 0,
|
xwl_surface_damage(xwl_seat->xwl_screen, xwl_cursor->surface, 0, 0,
|
||||||
xwl_seat->x_cursor->bits->width,
|
xwl_seat->x_cursor->bits->width,
|
||||||
xwl_seat->x_cursor->bits->height);
|
xwl_seat->x_cursor->bits->height);
|
||||||
|
|
|
@ -443,6 +443,12 @@ xwl_present_flip(WindowPtr present_window,
|
||||||
if (!xwl_window)
|
if (!xwl_window)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
|
buffer = xwl_glamor_pixmap_get_wl_buffer(pixmap);
|
||||||
|
if (!buffer) {
|
||||||
|
ErrorF("present: Error getting buffer\n");
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
damage_box = RegionExtents(damage);
|
damage_box = RegionExtents(damage);
|
||||||
|
|
||||||
event = malloc(sizeof *event);
|
event = malloc(sizeof *event);
|
||||||
|
@ -450,7 +456,6 @@ xwl_present_flip(WindowPtr present_window,
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
pixmap->refcnt++;
|
pixmap->refcnt++;
|
||||||
buffer = xwl_glamor_pixmap_get_wl_buffer(pixmap);
|
|
||||||
|
|
||||||
event->event_id = event_id;
|
event->event_id = event_id;
|
||||||
event->xwl_present_window = xwl_present_window;
|
event->xwl_present_window = xwl_present_window;
|
||||||
|
|
|
@ -805,6 +805,11 @@ xwl_window_post_damage(struct xwl_window *xwl_window)
|
||||||
#endif
|
#endif
|
||||||
buffer = xwl_shm_pixmap_get_wl_buffer(pixmap);
|
buffer = xwl_shm_pixmap_get_wl_buffer(pixmap);
|
||||||
|
|
||||||
|
if (!buffer) {
|
||||||
|
ErrorF("Error getting buffer\n");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
#ifdef XWL_HAS_GLAMOR
|
#ifdef XWL_HAS_GLAMOR
|
||||||
if (xwl_screen->glamor)
|
if (xwl_screen->glamor)
|
||||||
xwl_glamor_post_damage(xwl_window, pixmap, region);
|
xwl_glamor_post_damage(xwl_window, pixmap, region);
|
||||||
|
|
Loading…
Reference in New Issue