diff options
author | Lukas Stockner <lukas.stockner@freenet.de> | 2020-08-05 03:00:31 +0300 |
---|---|---|
committer | Lukas Stockner <lukas.stockner@freenet.de> | 2020-08-05 03:35:23 +0300 |
commit | 7198e9d10e2c9841f6ab35bdb5570ea1c7ebab30 (patch) | |
tree | 9ab8a805c7f6949d713ecaf74d5e3280a43482b7 /source/blender | |
parent | 1ccb997c6dadaf175a65c466ea87d35a017e3f1f (diff) |
Fix unreported crash in gpu_free_unused_buffers
As far as I can see, this problem was introduced with the gpu_free_unused_buffers() changes in rB97b597c.
The code checks the returned pointer to stop looping, but the last iteration will return the last GPUTexture and set the queue to NULL, meaning that the next pop() will crash.
Differential Revision: https://developer.blender.org/D8468
Diffstat (limited to 'source/blender')
-rw-r--r-- | source/blender/blenkernel/intern/image_gpu.c | 9 |
1 files changed, 3 insertions, 6 deletions
diff --git a/source/blender/blenkernel/intern/image_gpu.c b/source/blender/blenkernel/intern/image_gpu.c index e3ed7cdc8de..22fb6dfd02a 100644 --- a/source/blender/blenkernel/intern/image_gpu.c +++ b/source/blender/blenkernel/intern/image_gpu.c @@ -381,12 +381,9 @@ static void gpu_free_unused_buffers(void) BLI_mutex_lock(&gpu_texture_queue_mutex); - if (gpu_texture_free_queue != NULL) { - GPUTexture *tex; - while ((tex = (GPUTexture *)BLI_linklist_pop(&gpu_texture_free_queue))) { - GPU_texture_free(tex); - } - gpu_texture_free_queue = NULL; + while (gpu_texture_free_queue != NULL) { + GPUTexture *tex = BLI_linklist_pop(&gpu_texture_free_queue); + GPU_texture_free(tex); } BLI_mutex_unlock(&gpu_texture_queue_mutex); |