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
This commit is contained in:
Lukas Stockner
2020-08-05 02:00:31 +02:00
parent 1ccb997c6d
commit 7198e9d10e

View File

@@ -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);