diff options
author | Mikhail Burakov <mburakov@mailbox.org> | 2023-03-14 09:03:02 +0100 |
---|---|---|
committer | Mikhail Burakov <mburakov@mailbox.org> | 2023-03-14 09:03:02 +0100 |
commit | f602f85a215b1c59c775f4b5ddb0669e48d01283 (patch) | |
tree | ec3115b8280a1a8448f75a10fbb828413f7c9e26 | |
parent | 1c79dfed2c973b159b8f4a39a8087f772b70ceb0 (diff) |
Fix GpuFrame destruction sequence
-rw-r--r-- | gpu.c | 11 |
1 files changed, 6 insertions, 5 deletions
@@ -547,16 +547,17 @@ bool GpuFrameConvert(const struct GpuFrame* from, const struct GpuFrame* to) { void GpuFrameDestroy(struct GpuFrame** gpu_frame) { if (!gpu_frame || !*gpu_frame) return; for (size_t i = LENGTH((*gpu_frame)->textures); i; i--) { - if ((*gpu_frame)->textures[i]) - glDeleteTextures(1, &(*gpu_frame)->textures[i]); + if ((*gpu_frame)->textures[i - 1]) + glDeleteTextures(1, &(*gpu_frame)->textures[i - 1]); } for (size_t i = LENGTH((*gpu_frame)->images); i; i--) { - if ((*gpu_frame)->images[i] != EGL_NO_IMAGE) + if ((*gpu_frame)->images[i - 1] != EGL_NO_IMAGE) eglDestroyImage((*gpu_frame)->gpu_context->display, - (*gpu_frame)->images[i]); + (*gpu_frame)->images[i - 1]); } for (size_t i = LENGTH((*gpu_frame)->dmabuf_fds); i; i--) { - if ((*gpu_frame)->dmabuf_fds[i] != -1) close((*gpu_frame)->dmabuf_fds[i]); + if ((*gpu_frame)->dmabuf_fds[i - 1] != -1) + close((*gpu_frame)->dmabuf_fds[i - 1]); } free(*gpu_frame); *gpu_frame = NULL; |