From 4de7c883a6b5fb7a17adbec991bbd32e32e8b9c0 Mon Sep 17 00:00:00 2001 From: LittleGuo Date: Sun, 25 Oct 2026 18:05:51 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8D=20GiDrawUtility=20?= =?UTF-8?q?=E5=A4=B1=E8=B4=A5=E8=B7=AF=E5=BE=84=E5=86=85=E5=AD=98=E6=B3=84?= =?UTF-8?q?=E6=BC=8F=EF=BC=88L3-L6=EF=BC=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - L3: DrawLoft(曲线版) createRegion 失败时清理三个 clone 及已成功的 region - L4: DrawBox/DrawSphere 创建失败时释放 pSolid - L5: DrawMesh loft 失败时释放 pSection 数组与 vecPLs 中各 polyline - L6: DrawPipe(曲线,半径) ARX 扫掠分支补 DELETE_PTR(pReg),与 ZWCAD/extrude 分支对齐 --- .../Code2026/AecRxBase/GiDrawUtility.cpp | 22 ++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/SourceCode/Code2026/AecRxBase/GiDrawUtility.cpp b/SourceCode/Code2026/AecRxBase/GiDrawUtility.cpp index bd5121b..094b72c 100644 --- a/SourceCode/Code2026/AecRxBase/GiDrawUtility.cpp +++ b/SourceCode/Code2026/AecRxBase/GiDrawUtility.cpp @@ -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 {