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
(cherry picked from commit 25d2f4948f
)
This commit is contained in:
parent
8499fc0671
commit
740f00d44f
|
@ -162,8 +162,15 @@ static void
|
|||
xwl_cursor_attach_pixmap(struct xwl_seat *xwl_seat,
|
||||
struct xwl_cursor *xwl_cursor, PixmapPtr pixmap)
|
||||
{
|
||||
wl_surface_attach(xwl_cursor->surface,
|
||||
xwl_shm_pixmap_get_wl_buffer(pixmap), 0, 0);
|
||||
struct wl_buffer *buffer;
|
||||
|
||||
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_seat->x_cursor->bits->width,
|
||||
xwl_seat->x_cursor->bits->height);
|
||||
|
|
|
@ -443,6 +443,12 @@ xwl_present_flip(WindowPtr present_window,
|
|||
if (!xwl_window)
|
||||
return FALSE;
|
||||
|
||||
buffer = xwl_glamor_pixmap_get_wl_buffer(pixmap);
|
||||
if (!buffer) {
|
||||
ErrorF("present: Error getting buffer\n");
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
damage_box = RegionExtents(damage);
|
||||
|
||||
event = malloc(sizeof *event);
|
||||
|
@ -450,7 +456,6 @@ xwl_present_flip(WindowPtr present_window,
|
|||
return FALSE;
|
||||
|
||||
pixmap->refcnt++;
|
||||
buffer = xwl_glamor_pixmap_get_wl_buffer(pixmap);
|
||||
|
||||
event->event_id = event_id;
|
||||
event->xwl_present_window = xwl_present_window;
|
||||
|
|
|
@ -805,6 +805,11 @@ xwl_window_post_damage(struct xwl_window *xwl_window)
|
|||
#endif
|
||||
buffer = xwl_shm_pixmap_get_wl_buffer(pixmap);
|
||||
|
||||
if (!buffer) {
|
||||
ErrorF("Error getting buffer\n");
|
||||
return;
|
||||
}
|
||||
|
||||
#ifdef XWL_HAS_GLAMOR
|
||||
if (xwl_screen->glamor)
|
||||
xwl_glamor_post_damage(xwl_window, pixmap, region);
|
||||
|
|
Loading…
Reference in New Issue