From f4755ef695f6b9976d5b3d73988beaeb10909593 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Thu, 16 May 2019 21:41:37 +1000 Subject: Fix edit-mesh select crash when using face-dots The GPUVertBuf was freed but not the GPUBatch. Old bug exposed by new code from 8a6414ed46f66. --- source/blender/draw/intern/draw_cache_impl_mesh.c | 4 +++- source/blender/draw/intern/draw_manager.c | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) (limited to 'source/blender/draw/intern') diff --git a/source/blender/draw/intern/draw_cache_impl_mesh.c b/source/blender/draw/intern/draw_cache_impl_mesh.c index eb626e2f954..9fb9f9713d1 100644 --- a/source/blender/draw/intern/draw_cache_impl_mesh.c +++ b/source/blender/draw/intern/draw_cache_impl_mesh.c @@ -2214,9 +2214,11 @@ void DRW_mesh_batch_cache_dirty_tag(Mesh *me, int mode) GPU_BATCH_DISCARD_SAFE(cache->batch.edit_vertices); GPU_BATCH_DISCARD_SAFE(cache->batch.edit_edges); GPU_BATCH_DISCARD_SAFE(cache->batch.edit_facedots); + GPU_BATCH_DISCARD_SAFE(cache->batch.edit_selection_facedots); GPU_BATCH_DISCARD_SAFE(cache->batch.edit_mesh_analysis); cache->batch_ready &= ~(MBC_EDIT_TRIANGLES | MBC_EDIT_VERTICES | MBC_EDIT_EDGES | - MBC_EDIT_FACEDOTS | MBC_EDIT_MESH_ANALYSIS); + MBC_EDIT_FACEDOTS | MBC_EDIT_SELECTION_FACEDOTS | + MBC_EDIT_MESH_ANALYSIS); /* Because visible UVs depends on edit mode selection, discard everything. */ mesh_batch_cache_discard_uvedit(cache); break; diff --git a/source/blender/draw/intern/draw_manager.c b/source/blender/draw/intern/draw_manager.c index ca283e3a83a..e68f3e4b9e1 100644 --- a/source/blender/draw/intern/draw_manager.c +++ b/source/blender/draw/intern/draw_manager.c @@ -2801,7 +2801,7 @@ void DRW_draw_select_id_object(Scene *scene, if (select_mode & SCE_SELECT_VERTEX) { geom_verts = DRW_mesh_batch_cache_get_verts_with_select_id(me); } - if (draw_facedot) { + if (use_faceselect && draw_facedot) { geom_facedots = DRW_mesh_batch_cache_get_facedots_with_select_id(me); } DRW_mesh_batch_cache_create_requested(ob, me, NULL, false, true); -- cgit v1.2.3