impl->destroy cleanup:

- remove trivial destroy() function
 - make sure we check impl and impl->destroy before calling
 - always call free if not implemented
This commit is contained in:
Dominique Martinet 2017-08-14 16:16:20 +02:00
parent ba20d5b3ca
commit 4bbf718e7d
6 changed files with 11 additions and 10 deletions

View file

@ -9,8 +9,10 @@ void wlr_texture_init(struct wlr_texture *texture,
}
void wlr_texture_destroy(struct wlr_texture *texture) {
if (texture && texture->impl->destroy) {
if (texture && texture->impl && texture->impl->destroy) {
texture->impl->destroy(texture);
} else {
free(texture);
}
}