fix: 修复 GiDrawUtility 失败路径内存泄漏(L3-L6)

- L3: DrawLoft(曲线版) createRegion 失败时清理三个 clone 及已成功的 region
- L4: DrawBox/DrawSphere 创建失败时释放 pSolid
- L5: DrawMesh loft 失败时释放 pSection 数组与 vecPLs 中各 polyline
- L6: DrawPipe(曲线,半径) ARX 扫掠分支补 DELETE_PTR(pReg),与 ZWCAD/extrude 分支对齐
This commit is contained in:
gjm committed 2026-10-25 18:05:51 +08:00
1 parent fd422a0255
commit 4de7c883a6
1 file changed
+21 -1
@@ -235,7 +235,15 @@ AECDLLIMPEXP AcDbEntity* GiDrawUtility::DrawLoft(const AcDbCurve *pTop
AcDbRegion *pRegT = createRegion(_pTop);
AcDbRegion *pRegB = createRegion(_pBottom);
if (!pRegT || !pRegB) return NULL;
if (!pRegT || !pRegB)
{
DELETE_PTR(pRegT);
DELETE_PTR(pRegB);
DELETE_PTR(_pTop);
DELETE_PTR(_pBottom);
DELETE_PTR(_pLine);
return NULL;
}
AcDbEntity *p = DrawLoft(pRegT, pRegB, pLine);
@@ -367,6 +375,11 @@ AECDLLIMPEXP AcDbEntity* GiDrawUtility::DrawMesh( const Adesk::UInt32 &rows
if (pEnt->createLoftedSolid(vecPLs, vecGuides, &line, op) != Acad::eOk)
{
DELETE_PTR(pEnt);
delete [] pSection;
for (size_t i = 0; i < vecPLs.length(); ++i)
{
if (vecPLs[i]) DELETE_PTR(vecPLs[i]);
}
return NULL;
}
@@ -430,7 +443,10 @@ AECDLLIMPEXP AcDbEntity* GiDrawUtility::DrawBox(const AcGePoint3d &ptPos
AcDb3dSolid *pSolid = new AcDb3dSolid();
if (!pSolid) return NULL;
if (Acad::eOk != pSolid->createBox(X, Y, Z))
{
DELETE_PTR(pSolid);
return NULL;
}
pSolid->transformBy(
RotateAndMove(AcGeVector3d::kZAxis
@@ -447,7 +463,10 @@ AECDLLIMPEXP AcDbEntity* GiDrawUtility::DrawSphere(const AcGePoint3d &ptCenter
AcDb3dSolid *pSolid = new AcDb3dSolid();
if (!pSolid) return NULL;
if (Acad::eOk != pSolid->createSphere(dRadius))
{
DELETE_PTR(pSolid);
return NULL;
}
pSolid->transformBy(
RotateAndMove(AcGeVector3d::kZAxis
@@ -827,6 +846,7 @@ AcDbEntity* GiDrawUtility::DrawPipe(const AcDbCurve *pCurve, double dR)
acutPrintf(_T("\n拉伸错误:%d."), es);
DELETE_PTR(pSolid);
}
DELETE_PTR(pReg);
}
else
{