context_drm_egl: guard gbm_device on uninit

Not all cards support gbm which means the creation of the gbm device
will fail. However during the uninit process, the destruction of the
device was unconditionally done which leads to a segfault. Guard it
instead. Fixes #13929.
This commit is contained in:
Dudemanguy 2024-04-18 14:57:01 -05:00
parent 4d80e7b72c
commit e5d683e187
1 changed files with 2 additions and 1 deletions

View File

@ -491,7 +491,8 @@ static void drm_egl_uninit(struct ra_ctx *ctx)
if (p->gbm.surface)
gbm_surface_destroy(p->gbm.surface);
eglTerminate(p->egl.display);
gbm_device_destroy(p->gbm.device);
if (p->gbm.device)
gbm_device_destroy(p->gbm.device);
if (p->drm_params.render_fd != -1)
close(p->drm_params.render_fd);