Commit: 7198e9d10e2c9841f6ab35bdb5570ea1c7ebab30
Author: Lukas Stockner
Date:   Wed Aug 5 02:00:31 2020 +0200
Branches: master
https://developer.blender.org/rB7198e9d10e2c9841f6ab35bdb5570ea1c7ebab30

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

===================================================================

M       source/blender/blenkernel/intern/image_gpu.c

===================================================================

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

_______________________________________________
Bf-blender-cvs mailing list
[email protected]
https://lists.blender.org/mailman/listinfo/bf-blender-cvs

Reply via email to