egl/wayland: Don't segfault if `create_wl_buffer` returns `NULL`
authorIan Douglas Scott <ian@iandouglasscott.com>
Mon, 28 Aug 2023 23:18:01 +0000 (16:18 -0700)
committerMarge Bot <emma+marge@anholt.net>
Fri, 6 Oct 2023 18:31:29 +0000 (18:31 +0000)
commit1950481d08d706e8f23780f7a44802a6ed5f5c52
tree7e2009029f1a0e034bf94625737fff152e0babfc
parent82e342888f3891a867b4fd51d35ff4ffffe98bad
egl/wayland: Don't segfault if `create_wl_buffer` returns `NULL`

Normally, this shouldn't fail, but it has various cases where it returns
`NULL`. Without this change, it would result in a segfault when
`wl_buffer_add_listener` is called.

This instead makes `EGLSwapBuffers` return a `EGL_BAD_ALLOC` error.

The other place `create_wl_buffer` is called already checks the return
value, and the Vulkan WSI code doesn't seem to have an issue like this.

Signed-off-by: Ian Douglas Scott <ian@iandouglasscott.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24915>
src/egl/drivers/dri2/platform_wayland.c