[Bf-blender-cvs] [ddbc351] master: Fix recent issue in recent BVH snap/cache
Campbell Barton
noreply at git.blender.org
Fri May 6 19:10:45 CEST 2016
Commit: ddbc351dd30f414dd5d8ceb1621c8c4cac3d7e43
Author: Campbell Barton
Date: Sat May 7 02:59:19 2016 +1000
Branches: master
https://developer.blender.org/rBddbc351dd30f414dd5d8ceb1621c8c4cac3d7e43
Fix recent issue in recent BVH snap/cache
The derivedMesh could free a tree stored by the cache.
Now check the cached tree is valid.
===================================================================
M source/blender/editors/transform/transform_snap_object.c
===================================================================
diff --git a/source/blender/editors/transform/transform_snap_object.c b/source/blender/editors/transform/transform_snap_object.c
index ea34895..754061c 100644
--- a/source/blender/editors/transform/transform_snap_object.c
+++ b/source/blender/editors/transform/transform_snap_object.c
@@ -33,6 +33,7 @@
#include "BLI_kdopbvh.h"
#include "BLI_memarena.h"
#include "BLI_ghash.h"
+#include "BLI_linklist.h"
#include "BLI_utildefines.h"
#include "DNA_armature_types.h"
@@ -659,6 +660,14 @@ static bool snapDerivedMesh(
sod->bvh_trees[tree_index] = BLI_memarena_calloc(sctx->cache.mem_arena, sizeof(*treedata));
}
treedata = sod->bvh_trees[tree_index];
+
+ /* the tree is owned by the DM and may have been freed since we last used! */
+ if (treedata && treedata->tree) {
+ if (BLI_linklist_index(dm->bvhCache, treedata->tree) == -1) {
+ free_bvhtree_from_mesh(treedata);
+
+ }
+ }
}
}
else {
More information about the Bf-blender-cvs
mailing list