diff options
author | Campbell Barton <ideasman42@gmail.com> | 2018-06-04 16:15:34 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2018-06-04 16:18:48 +0300 |
commit | 52f9023fbffc709346f8adcc0145140ce158221e (patch) | |
tree | 68d7251e78ceba5698904d137672a73526412e80 /source/blender/blenkernel | |
parent | 07f004620397fd818d2684d08ff67422d76a92cf (diff) |
Fix weight paint crash
The PBVH was referencing runtime custom data which was freed on refresh.
Diffstat (limited to 'source/blender/blenkernel')
-rw-r--r-- | source/blender/blenkernel/intern/cdderivedmesh.c | 6 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/subsurf_ccg.c | 6 |
2 files changed, 10 insertions, 2 deletions
diff --git a/source/blender/blenkernel/intern/cdderivedmesh.c b/source/blender/blenkernel/intern/cdderivedmesh.c index 773ef90aac8..562563390c4 100644 --- a/source/blender/blenkernel/intern/cdderivedmesh.c +++ b/source/blender/blenkernel/intern/cdderivedmesh.c @@ -55,6 +55,8 @@ #include "DNA_object_types.h" #include "DNA_curve_types.h" /* for Curve */ +#include "DEG_depsgraph_query.h" + #include "MEM_guardedalloc.h" #include <string.h> @@ -289,7 +291,9 @@ static PBVH *cdDM_getPBVH(Object *ob, DerivedMesh *dm) * this derivedmesh is just original mesh. it's the multires subsurf dm * that this is actually for, to support a pbvh on a modified mesh */ if (!cddm->pbvh && ob->type == OB_MESH) { - Mesh *me = ob->data; + Object *ob_orig = DEG_get_original_object(ob); + Mesh *me = ob_orig->data; + BLI_assert(!(me->id.tag & LIB_TAG_NO_MAIN)); const int looptris_num = poly_to_tri_count(me->totpoly, me->totloop); MLoopTri *looptri; bool deformed; diff --git a/source/blender/blenkernel/intern/subsurf_ccg.c b/source/blender/blenkernel/intern/subsurf_ccg.c index ed23078a9d8..bc54c554ee4 100644 --- a/source/blender/blenkernel/intern/subsurf_ccg.c +++ b/source/blender/blenkernel/intern/subsurf_ccg.c @@ -73,6 +73,8 @@ #include "BKE_scene.h" #include "BKE_subsurf.h" +#include "DEG_depsgraph_query.h" + #ifndef USE_DYNSIZE # include "BLI_array.h" #endif @@ -2327,7 +2329,9 @@ static struct PBVH *ccgDM_getPBVH(Object *ob, DerivedMesh *dm) numGrids, &key, (void **) ccgdm->gridFaces, ccgdm->gridFlagMats, ccgdm->gridHidden); } else if (ob->type == OB_MESH) { - Mesh *me = ob->data; + Object *ob_orig = DEG_get_original_object(ob); + Mesh *me = ob_orig->data; + BLI_assert(!(me->id.tag & LIB_TAG_NO_MAIN)); const int looptris_num = poly_to_tri_count(me->totpoly, me->totloop); MLoopTri *looptri; |