Fix T64403: crash sampling coloring in texture paint mode
authorBrecht Van Lommel <brechtvanlommel@gmail.com>
Mon, 13 May 2019 09:45:16 +0000 (11:45 +0200)
committerBrecht Van Lommel <brechtvanlommel@gmail.com>
Mon, 13 May 2019 09:50:21 +0000 (11:50 +0200)
source/blender/editors/space_view3d/drawobject.c

index 638c77fc3cbe7b03682b84849cf75fa2ee2dc310..fbec99c5f2832fa0c85984f777b757f2a8e45c9c 100644 (file)
@@ -221,6 +221,8 @@ static void bbs_mesh_solid_verts(Depsgraph *UNUSED(depsgraph),
 {
   Mesh *me = ob->data;
 
+  DRW_mesh_batch_cache_validate(me);
+
   GPUBatch *geom_faces = DRW_mesh_batch_cache_get_triangles_with_select_id(me);
   GPUBatch *geom_verts = DRW_mesh_batch_cache_get_verts_with_select_id(me);
   DRW_mesh_batch_cache_create_requested(ob, me, NULL, false, true);
@@ -239,6 +241,8 @@ static void bbs_mesh_solid_faces(Scene *UNUSED(scene),
   Mesh *me = ob->data;
   Mesh *me_orig = DEG_get_original_object(ob)->data;
 
+  DRW_mesh_batch_cache_validate(me);
+
   const bool use_hide = (me_orig->editflag & ME_EDIT_PAINT_FACE_SEL);
   GPUBatch *geom_faces = DRW_mesh_batch_cache_get_triangles_with_select_id(me);
   DRW_mesh_batch_cache_create_requested(ob, me, NULL, false, use_hide);
@@ -275,6 +279,8 @@ void draw_object_select_id(Depsgraph *depsgraph,
         const bool draw_facedot = check_ob_drawface_dot(scene, v3d, ob->dt);
         const bool use_faceselect = (select_mode & SCE_SELECT_FACE) != 0;
 
+        DRW_mesh_batch_cache_validate(me);
+
         BM_mesh_elem_table_ensure(em->bm, BM_VERT | BM_EDGE | BM_FACE);
 
         GPUBatch *geom_faces, *geom_edges, *geom_verts, *geom_facedots;