diff options
author | Dalai Felinto <dfelinto@gmail.com> | 2018-05-09 16:38:58 +0300 |
---|---|---|
committer | Dalai Felinto <dfelinto@gmail.com> | 2018-05-09 16:53:16 +0300 |
commit | 828a3d89b39b49a265a4ba7875dcb3edfe9c477f (patch) | |
tree | 81ed8818b924724e58fef096a5a4991c8dfbd732 | |
parent | ed23bd5f3c51e812ba097cdbac0a480577c9df4b (diff) |
Fix T55015: Crash on selection after recent BVH changes
Runtime data should always be initialized to NULL on read-time.
-rw-r--r-- | source/blender/blenkernel/BKE_mesh.h | 2 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/mesh_runtime.c | 7 | ||||
-rw-r--r-- | source/blender/blenloader/intern/readfile.c | 4 |
3 files changed, 10 insertions, 3 deletions
diff --git a/source/blender/blenkernel/BKE_mesh.h b/source/blender/blenkernel/BKE_mesh.h index a170a2a32eb..53300e92e67 100644 --- a/source/blender/blenkernel/BKE_mesh.h +++ b/source/blender/blenkernel/BKE_mesh.h @@ -192,7 +192,7 @@ void BKE_mesh_mselect_active_set(struct Mesh *me, int index, int type); void BKE_mesh_apply_vert_coords(struct Mesh *mesh, float (*vertCoords)[3]); /* *** mesh_runtime.c *** */ - +void BKE_mesh_runtime_reset(struct Mesh *mesh); int BKE_mesh_runtime_looptri_len(const struct Mesh *mesh); void BKE_mesh_runtime_looptri_recalc(struct Mesh *mesh); const struct MLoopTri *BKE_mesh_runtime_looptri_ensure(struct Mesh *mesh); diff --git a/source/blender/blenkernel/intern/mesh_runtime.c b/source/blender/blenkernel/intern/mesh_runtime.c index aebf03151d1..96d31fa9a42 100644 --- a/source/blender/blenkernel/intern/mesh_runtime.c +++ b/source/blender/blenkernel/intern/mesh_runtime.c @@ -44,6 +44,13 @@ static ThreadRWMutex loops_cache_lock = PTHREAD_RWLOCK_INITIALIZER; +/** + * Default values defined at read time. + */ +void BKE_mesh_runtime_reset(Mesh *mesh) +{ + memset(&mesh->runtime, 0, sizeof(mesh->runtime)); +} /* This is a ported copy of DM_ensure_looptri_data(dm) */ /** diff --git a/source/blender/blenloader/intern/readfile.c b/source/blender/blenloader/intern/readfile.c index e65d4e17539..56f18072843 100644 --- a/source/blender/blenloader/intern/readfile.c +++ b/source/blender/blenloader/intern/readfile.c @@ -4685,8 +4685,8 @@ static void direct_link_mesh(FileData *fd, Mesh *mesh) mesh->bb = NULL; mesh->edit_btmesh = NULL; - mesh->runtime.batch_cache = NULL; - + BKE_mesh_runtime_reset(mesh); + /* happens with old files */ if (mesh->mselect == NULL) { mesh->totselect = 0; |