Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSergey Sharybin <sergey.vfx@gmail.com>2011-11-24 17:39:43 +0400
committerSergey Sharybin <sergey.vfx@gmail.com>2011-11-24 17:39:43 +0400
commit51014d8e4f45c132433f1319ddfa67419455c670 (patch)
tree30f14092ffbb993980948ab8e797375855d0e37c /source/blender/blenlib
parent7187fd46c654cd6236b34d8bd737d2394afb21ab (diff)
Fix #29384: Mesh without polygons + Modifier crashes when switching to sculpt mode
There were some issues with PBVH which prevented working it for meshes without faces. Discussed with Brecht, for benefits of dynamic-topology-sculpting and so better to make PBVH survive such things. Added some extra NULL-pointer checks for this.
Diffstat (limited to 'source/blender/blenlib')
-rw-r--r--source/blender/blenlib/intern/pbvh.c14
1 files changed, 11 insertions, 3 deletions
diff --git a/source/blender/blenlib/intern/pbvh.c b/source/blender/blenlib/intern/pbvh.c
index 0ac6e0ba4df..5c7a29c6277 100644
--- a/source/blender/blenlib/intern/pbvh.c
+++ b/source/blender/blenlib/intern/pbvh.c
@@ -656,12 +656,17 @@ void BLI_pbvh_free(PBVH *bvh)
/* if pbvh was deformed, new memory was allocated for verts/faces -- free it */
MEM_freeN(bvh->verts);
- MEM_freeN(bvh->faces);
+ if(bvh->faces)
+ MEM_freeN(bvh->faces);
}
}
- MEM_freeN(bvh->nodes);
- MEM_freeN(bvh->prim_indices);
+ if(bvh->nodes)
+ MEM_freeN(bvh->nodes);
+
+ if(bvh->prim_indices)
+ MEM_freeN(bvh->prim_indices);
+
MEM_freeN(bvh);
}
@@ -1127,6 +1132,9 @@ void BLI_pbvh_update(PBVH *bvh, int flag, float (*face_nors)[3])
PBVHNode **nodes;
int totnode;
+ if(!bvh->nodes)
+ return;
+
BLI_pbvh_search_gather(bvh, update_search_cb, SET_INT_IN_POINTER(flag),
&nodes, &totnode);