summaryrefslogtreecommitdiff
path: root/gpu.c
diff options
context:
space:
mode:
authorMikhail Burakov <mburakov@mailbox.org>2023-03-14 09:03:02 +0100
committerMikhail Burakov <mburakov@mailbox.org>2023-03-14 09:03:02 +0100
commitf602f85a215b1c59c775f4b5ddb0669e48d01283 (patch)
treeec3115b8280a1a8448f75a10fbb828413f7c9e26 /gpu.c
parent1c79dfed2c973b159b8f4a39a8087f772b70ceb0 (diff)
Fix GpuFrame destruction sequence
Diffstat (limited to 'gpu.c')
-rw-r--r--gpu.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/gpu.c b/gpu.c
index 081acbe..43f61b7 100644
--- a/gpu.c
+++ b/gpu.c
@@ -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;