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.
Unified · Split
| @@ -491,7 +491,8 @@ static void drm_egl_uninit(struct ra_ctx *ctx) · 490 unmodified lines | |||
| 491 | if (p->gbm.surface) | 491 | if (p->gbm.surface) |
| 492 | gbm_surface_destroy(p->gbm.surface); | 492 | gbm_surface_destroy(p->gbm.surface); |
| 493 | eglTerminate(p->egl.display); | 493 | eglTerminate(p->egl.display); |
| 494 | gbm_device_destroy(p->gbm.device); | 494 | if (p->gbm.device) |
| 495 | gbm_device_destroy(p->gbm.device); | ||
| 495 | 496 | ||
| 496 | if (p->drm_params.render_fd != -1) | 497 | if (p->drm_params.render_fd != -1) |
| 497 | close(p->drm_params.render_fd); | 498 | close(p->drm_params.render_fd); |