loader/dri3: temporarily work around a crash when front is NULL

Commit c65bde7b1e introduced a regression where under certain
circumstances `front` may be NULL, thus leading to a crash. It's not
currently known what exactly causes `front` to become NULL, nor we can
revert the offending commit, because there had been too many unrelated
changes that now depend on this commit.

So until someone comes up with a proper fix, let's add a workaround so
instead of crashing we just return from the function early.

This commit was tested with the bug `8982` and helps with the crash
with no other noticeable problems.

Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/8982
Fixes: c65bde7b1e ("frontend/dri: inline __DRIdrawable in dri_drawable, make __DRIdrawable opaque")
Cc: mesa-stable
Signed-off-by: Konstantin Kharlamov <Hi-Angel@yandex.ru>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/23093>
(cherry picked from commit 275cf62e20)
This commit is contained in:
Konstantin Kharlamov 2023-05-18 03:27:08 +03:00 committed by Eric Engestrom
parent 2630f4b310
commit eef0f7f1ea
2 changed files with 6 additions and 1 deletions

View file

@ -1381,7 +1381,7 @@
"description": "loader/dri3: temporarily work around a crash when front is NULL",
"nominated": true,
"nomination_type": 1,
"resolution": 0,
"resolution": 1,
"main_sha": null,
"because_sha": "c65bde7b1e03ccb3dcc53bd3d8c1e5560449ddb6"
},

View file

@ -955,6 +955,11 @@ loader_dri3_wait_gl(struct loader_dri3_drawable *draw)
return;
front = dri3_front_buffer(draw);
/* TODO: `front` is not supposed to be NULL here, fix the actual bug
* https://gitlab.freedesktop.org/mesa/mesa/-/issues/8982
*/
if (!front)
return;
/* In the psc->is_different_gpu case, we update the linear_buffer
* before updating the real front.