xwayland/glamor: Disable GLAMOR after GBM cleanup

The cleanup function for GBM is called on the various error paths.

Once xwl_glamor_gbm_cleanup() has been called, GBM support is no longer
usable (and the corresponding data structures are freed), so there is
no way we can keep using GLAMOR after that point.

Make sure to explicitly disable GLAMOR support in that case, so we do
not crash later on trying to use GBM.

Signed-off-by: Olivier Fourdan <ofourdan@redhat.com>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1768>
This commit is contained in:
Olivier Fourdan 2025-02-04 11:35:36 +01:00
parent b27b5cd5f3
commit e8784b7d89

View File

@ -634,6 +634,10 @@ xwl_glamor_gbm_cleanup(struct xwl_screen *xwl_screen)
if (!xwl_gbm) if (!xwl_gbm)
return; return;
/* Cannot use GBM after clean-up, disable GLAMOR support from now on */
ErrorF("XWAYLAND: Disabling GLAMOR support\n");
xwl_screen->glamor = XWL_GLAMOR_NONE;
if (xwl_gbm->device_name) if (xwl_gbm->device_name)
free(xwl_gbm->device_name); free(xwl_gbm->device_name);
drmFreeDevice(&xwl_gbm->device); drmFreeDevice(&xwl_gbm->device);