From 2a95c41bb76e3c34fe0b887e5b0cbb51aa4c5ae9 Mon Sep 17 00:00:00 2001 From: Roman Telezhynskyi Date: Sat, 11 Jan 2020 15:08:55 +0200 Subject: [PATCH] Cover case when we can safely ignore broken union details operation. --HG-- branch : develop --- src/libs/vtools/tools/vtooluniondetails.cpp | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/src/libs/vtools/tools/vtooluniondetails.cpp b/src/libs/vtools/tools/vtooluniondetails.cpp index a1a12424c..102d7933f 100644 --- a/src/libs/vtools/tools/vtooluniondetails.cpp +++ b/src/libs/vtools/tools/vtooluniondetails.cpp @@ -1647,10 +1647,19 @@ void UniteDetails(const VToolUnionDetailsInitData &initData) } else { - const VPiecePath d1Path = GetPiece1MainPath(initData.doc, initData.id); - const VPiecePath d2Path = GetPiece2MainPath(initData.doc, initData.id); - UnionInitParameters(initData, d1Path, d2Path, det1p1, dx, dy, angle); - UpdateUnitedDetail(initData, dx, dy, det1p1.GetId(), angle); + try + { + const VPiecePath d1Path = GetPiece1MainPath(initData.doc, initData.id); + const VPiecePath d2Path = GetPiece2MainPath(initData.doc, initData.id); + UnionInitParameters(initData, d1Path, d2Path, det1p1, dx, dy, angle); + UpdateUnitedDetail(initData, dx, dy, det1p1.GetId(), angle); + } + catch (const VExceptionBadId &) + { + // There is a chance that the tool depends on an already deleted object. We can skip updating in this case. + // We still can get error in child in case we should not get an error here. Debug will be a little bit + // obscured. But if this happened something really bad happened. + } } } } // static functions