Fix T57097: Crash when adding a Texture Slot in Texture Paint mode

Was caused by the use of a batch that was using a discarded index buffer.
This commit is contained in:
Clément Foucault 2018-10-09 17:54:40 +02:00
parent d2eb7e8dfa
commit c630ce3f6d
Notes: blender-bot 2023-02-14 10:04:50 +01:00
Referenced by issue #57125, Mesh element selection does not work when using duplis.
Referenced by issue #57094, Changing to other view modes while using solid color in viewport causes crash
Referenced by issue #57097, Adding a Texture Slot in Texture Paint mode produces a crash
1 changed files with 7 additions and 1 deletions

View File

@ -1843,9 +1843,15 @@ static void mesh_batch_cache_discard_shaded_tri(MeshBatchCache *cache)
GPU_BATCH_DISCARD_SAFE(cache->shaded_triangles[i]);
}
}
if (cache->texpaint_triangles) {
for (int i = 0; i < cache->mat_len; ++i) {
/* They use shaded_triangles_in_order */
GPU_BATCH_DISCARD_SAFE(cache->texpaint_triangles[i]);
}
}
MEM_SAFE_FREE(cache->shaded_triangles_in_order);
MEM_SAFE_FREE(cache->shaded_triangles);
MEM_SAFE_FREE(cache->texpaint_triangles);
MEM_SAFE_FREE(cache->auto_layer_names);
MEM_SAFE_FREE(cache->auto_layer_is_srgb);