render/egl: allow passing NULL to surface and image destructors

This commit is contained in:
emersion 2018-04-25 00:42:19 +01:00
parent eaed6bd03b
commit 018b82c01e
No known key found for this signature in database
GPG key ID: 0FDE7BE0E88F5E48
5 changed files with 14 additions and 19 deletions

View file

@ -79,9 +79,7 @@ bool wlr_drm_surface_init(struct wlr_drm_surface *surf,
}
gbm_surface_destroy(surf->gbm);
}
if (surf->egl) {
wlr_egl_destroy_surface(&surf->renderer->egl, surf->egl);
}
wlr_egl_destroy_surface(&surf->renderer->egl, surf->egl);
surf->gbm = gbm_surface_create(renderer->gbm, width, height,
format, GBM_BO_USE_RENDERING | flags);
@ -117,9 +115,7 @@ void wlr_drm_surface_finish(struct wlr_drm_surface *surf) {
gbm_surface_release_buffer(surf->gbm, surf->back);
}
if (surf->egl) {
wlr_egl_destroy_surface(&surf->renderer->egl, surf->egl);
}
wlr_egl_destroy_surface(&surf->renderer->egl, surf->egl);
if (surf->gbm) {
gbm_surface_destroy(surf->gbm);
}