[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [60236] trunk/blender/source/blender/ editors/mesh/editmesh_knife.c: Fix potential crash in knife.
Howard Trickey
howard.trickey at gmail.com
Thu Sep 19 14:47:36 CEST 2013
Revision: 60236
http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=60236
Author: howardt
Date: 2013-09-19 12:47:35 +0000 (Thu, 19 Sep 2013)
Log Message:
-----------
Fix potential crash in knife.
A crash was reported but without info to reproduce.
This is a likely crash introduced by previous fix
to allow linehits to snap to vertices.
The function to find connected linehits can't
assume all linehits have edges any more.
Modified Paths:
--------------
trunk/blender/source/blender/editors/mesh/editmesh_knife.c
Modified: trunk/blender/source/blender/editors/mesh/editmesh_knife.c
===================================================================
--- trunk/blender/source/blender/editors/mesh/editmesh_knife.c 2013-09-19 11:25:47 UTC (rev 60235)
+++ trunk/blender/source/blender/editors/mesh/editmesh_knife.c 2013-09-19 12:47:35 UTC (rev 60236)
@@ -590,24 +590,56 @@
static int find_connected_linehit(KnifeTool_OpData *kcd, int testi, BMFace *f, int firsti, int lasti)
{
int i;
+ ListBase *testfaces, *ifaces;
+ BMFace *testface, *iface;
+ BMEdgeHit *lh;
+ bool shareface;
+ if (testi >= 0 && testi < kcd->totlinehit) {
+ testface = NULL;
+ testfaces = NULL;
+ lh = &kcd->linehits[testi];
+ if (lh->v)
+ testfaces = &lh->v->faces;
+ else if (lh->kfe)
+ testfaces = &lh->kfe->faces;
+ else if (lh->f) {
+ testfaces = NULL;
+ testface = lh->f;
+ }
+ }
+ else {
+ testface = f;
+ testfaces = NULL;
+ }
for (i = firsti; i <= lasti; i++) {
- if (testi >= 0 && testi < kcd->totlinehit) {
- if (knife_find_common_face(&kcd->linehits[testi].kfe->faces,
- &kcd->linehits[i].kfe->faces))
- {
- return i;
- }
- else if (kcd->linehits[testi].v &&
- kcd->linehits[testi].v == kcd->linehits[i].v)
- {
- return i;
- }
+ shareface = false;
+ lh = &kcd->linehits[i];
+ iface = NULL;
+ ifaces = NULL;
+ if (lh->v)
+ ifaces = &lh->v->faces;
+ else if (lh->kfe)
+ ifaces = &lh->kfe->faces;
+ else if (lh->f) {
+ ifaces = NULL;
+ iface = lh->f;
}
- else if (f) {
- if (find_ref(&kcd->linehits[i].kfe->faces, f))
- return i;
+ if (testfaces) {
+ if (ifaces)
+ shareface = knife_find_common_face(testfaces, ifaces);
+ else if (iface)
+ shareface = find_ref(testfaces, iface);
}
+ else if (ifaces) {
+ if (testface)
+ shareface = find_ref(ifaces, testface);
+ }
+ else if (testface && iface) {
+ shareface = (testface == iface);
+ }
+ if (shareface)
+ return i;
}
return -1;
}
More information about the Bf-blender-cvs
mailing list