xwayland/eglstream: Check buffer creation
EGLStream wl_eglstream_display_create_stream() may fail, yet Xwayland would try to attach the buffer which may cause a fatal Wayland protocol error raised by the compositor. Check if the buffer creation worked, and fail gracefully otherwise (like wayland-eglsurface does). 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
4f6fbd5009
commit
4f0889e983
|
@ -548,6 +548,10 @@ xwl_eglstream_create_pending_stream(struct xwl_screen *xwl_screen,
|
|||
stream_fd,
|
||||
WL_EGLSTREAM_HANDLE_TYPE_FD,
|
||||
&stream_attribs);
|
||||
if (!xwl_pixmap->buffer) {
|
||||
ErrorF("eglstream: Failed to create buffer\n");
|
||||
goto fail;
|
||||
}
|
||||
|
||||
wl_buffer_add_listener(xwl_pixmap->buffer,
|
||||
&xwl_eglstream_buffer_release_listener,
|
||||
|
@ -562,7 +566,9 @@ xwl_eglstream_create_pending_stream(struct xwl_screen *xwl_screen,
|
|||
|
||||
xwl_eglstream_queue_pending_stream(xwl_screen, window, pixmap);
|
||||
|
||||
close(stream_fd);
|
||||
fail:
|
||||
if (stream_fd >= 0)
|
||||
close(stream_fd);
|
||||
}
|
||||
|
||||
static Bool
|
||||
|
|
Loading…
Reference in New Issue