View Issue Details

IDProjectCategoryView StatusLast Update
0033489Open CASCADEOCCT:Data Exchangepublic2023-09-22 18:19
Reporteroan Assigned Todpasukhi  
PrioritynormalSeverityminor 
Status newResolutionopen 
Target Version7.7.2 
Summary0033489: Data Exchange - redundant instances of XCAFDoc_GraphNode are created in XCAFDoc_ViewTool
DescriptionThere 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.
TagsNo tags attached.
Test case number

Activities

There are no notes attached to this issue.

Issue History

Date Modified Username Field Change
2023-09-22 18:19 oan New Issue
2023-09-22 18:19 oan Assigned To => ika
2023-09-22 18:19 oan Assigned To ika => dpasukhi