View Issue Details
ID | Project | Category | View Status | Date Submitted | Last Update |
---|---|---|---|---|---|
0033489 | Open CASCADE | OCCT:Data Exchange | public | 2023-09-22 18:19 | 2023-09-22 18:19 |
Reporter | oan | Assigned To | dpasukhi | ||
Priority | normal | Severity | minor | ||
Status | new | Resolution | open | ||
Target Version | 7.7.2 | ||||
Summary | 0033489: Data Exchange - redundant instances of XCAFDoc_GraphNode are created in XCAFDoc_ViewTool | ||||
Description | There are several places inside XCAFDoc_ViewTool.cxx where temporary dynamic XCAFDoc_GraphNode objects are created, e.g.: XCAFDoc_ViewTool::SetView(): if (!theViewL.FindAttribute(XCAFDoc::ViewRefShapeGUID(), aChGNode) && theShapeLabels.Length() > 0) { aChGNode = new XCAFDoc_GraphNode; aChGNode = XCAFDoc_GraphNode::Set(theViewL); aChGNode->SetGraphID(XCAFDoc::ViewRefShapeGUID()); } Here, operator new is called explicitly while on the next line a new object is created by XCAFDoc_GraphNode::Set() and assigned to the same variable again: Handle(XCAFDoc_GraphNode) XCAFDoc_GraphNode::Set(const TDF_Label& L) { Handle(XCAFDoc_GraphNode) GN; if (!L.FindAttribute(XCAFDoc_GraphNode::GetDefaultGraphID(), GN)) { GN = new XCAFDoc_GraphNode(); GN->SetGraphID(XCAFDoc_GraphNode::GetDefaultGraphID()); L.AddAttribute(GN); } return GN; } Logically, there is no obvious reason to create the first instance of XCAFDoc_GraphNode that is done outside XCAFDoc_GraphNode::Set() method and those lines could be removed. | ||||
Tags | No tags attached. | ||||
Test case number | |||||