From e8784b7d897aa22ed93f63a57dea04bdfa784388 Mon Sep 17 00:00:00 2001 From: Olivier Fourdan Date: Tue, 4 Feb 2025 11:35:36 +0100 Subject: [PATCH] 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 Part-of: --- hw/xwayland/xwayland-glamor-gbm.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/hw/xwayland/xwayland-glamor-gbm.c b/hw/xwayland/xwayland-glamor-gbm.c index ce80284e0..05668b8e9 100644 --- a/hw/xwayland/xwayland-glamor-gbm.c +++ b/hw/xwayland/xwayland-glamor-gbm.c @@ -634,6 +634,10 @@ xwl_glamor_gbm_cleanup(struct xwl_screen *xwl_screen) if (!xwl_gbm) 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) free(xwl_gbm->device_name); drmFreeDevice(&xwl_gbm->device);