Fix edit-mesh select crash when using face-dots
authorCampbell Barton <ideasman42@gmail.com>
Thu, 16 May 2019 11:41:37 +0000 (21:41 +1000)
committerCampbell Barton <ideasman42@gmail.com>
Thu, 16 May 2019 11:45:24 +0000 (21:45 +1000)
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
source/blender/draw/intern/draw_manager.c

index eb626e2..9fb9f97 100644 (file)
@@ -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;
index ca283e3..e68f3e4 100644 (file)
@@ -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);