=bmesh= fixed knifetool mem leak
This commit is contained in:
@@ -133,45 +133,6 @@ static void BMEdit_RecalcTesselation_intern(BMEditMesh *tm)
|
||||
|
||||
if (tm->looptris) MEM_freeN(tm->looptris);
|
||||
|
||||
#if 0 //simple quad/triangle code for performance testing purposes
|
||||
looptris = MEM_callocN(sizeof(void*)*bm->totface*8, "looptris");
|
||||
|
||||
f = BMIter_New(&iter, bm, BM_FACES_OF_MESH, NULL);
|
||||
for ( ; f; f=BMIter_Step(&iter)) {
|
||||
EditVert *v, *lastv=NULL, *firstv=NULL;
|
||||
EditEdge *e;
|
||||
EditFace *efa;
|
||||
|
||||
/*don't consider two-edged faces*/
|
||||
if (f->len < 3) continue;
|
||||
|
||||
//BLI_array_growone(looptris);
|
||||
//BLI_array_growone(looptris);
|
||||
//BLI_array_growone(looptris);
|
||||
|
||||
looptris[i*3] = f->loopbase;
|
||||
looptris[i*3+1] = f->loopbase->head.next;
|
||||
looptris[i*3+2] = f->loopbase->head.next->next;
|
||||
i++;
|
||||
|
||||
if (f->len > 3) {
|
||||
//BLI_array_growone(looptris);
|
||||
//BLI_array_growone(looptris);
|
||||
//BLI_array_growone(looptris);
|
||||
|
||||
looptris[i*3] = f->loopbase;
|
||||
looptris[i*3+1] = f->loopbase->head.next->next;
|
||||
looptris[i*3+2] = f->loopbase->head.next->next->next;
|
||||
i++;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
tm->tottri = i;
|
||||
tm->looptris = looptris;
|
||||
return;
|
||||
#endif
|
||||
|
||||
f = BMIter_New(&iter, bm, BM_FACES_OF_MESH, NULL);
|
||||
for ( ; f; f=BMIter_Step(&iter)) {
|
||||
EditVert *v, *lastv=NULL, *firstv=NULL;
|
||||
|
||||
@@ -886,7 +886,9 @@ static BMEdgeHit *knife_edge_tri_isect(knifetool_opdata *kcd, BMBVHTree *bmtree,
|
||||
if (results)
|
||||
MEM_freeN(results);
|
||||
|
||||
BLI_bvhtree_free(tree2);
|
||||
*count = BLI_array_count(edges);
|
||||
|
||||
return edges;
|
||||
}
|
||||
|
||||
@@ -1813,8 +1815,10 @@ static int knifetool_modal (bContext *C, wmOperator *op, wmEvent *event)
|
||||
}
|
||||
|
||||
obedit = CTX_data_edit_object(C);
|
||||
if (!obedit || obedit->type != OB_MESH || ((Mesh*)obedit->data)->edit_btmesh != kcd->em)
|
||||
if (!obedit || obedit->type != OB_MESH || ((Mesh*)obedit->data)->edit_btmesh != kcd->em) {
|
||||
knifetool_exit(C, op);
|
||||
return OPERATOR_FINISHED;
|
||||
}
|
||||
|
||||
view3d_operator_needs_opengl(C);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user