https://issues.apache.org/ooo/show_bug.cgi?id=124065
--- Comment #4 from [email protected] --- (In reply to Andre from comment #3) > Can you explain why creating the clones is not necessary and why it is safe > to share the underlying ScRangeName? Hi Andre, 1. Firstly, the clone is quite time consuming, so we should try to avoid it as possible as we can. Takes 1000 name ranges for example, there will be 1000*1000 steps to process. outer loop /* 1000 entries */ clone (inner loop /* 1000 entries */) virtual ScDataObject* Clone(ScDocument* pDocP) const { return new ScRangeName(*this, pDocP); } ScRangeName::ScRangeName(const ScRangeName& rScRangeName, ScDocument* pDocument) : ScSortedCollection ( rScRangeName ), pDoc ( pDocument ), nSharedMaxIndex (rScRangeName.nSharedMaxIndex) { for (USHORT i = 0; i < nCount; i++) { ((ScRangeData*)At(i))->SetDocument(pDocument); ((ScRangeData*)At(i))->SetIndex(((ScRangeData*)rScRangeName.At(i))->GetIndex()); } } 2. For this case, we have got all the name ranges, and it is one of the document's member variables. We can just manipulate it directly, and there is no need to clone a new ScRangeName object. All the operations done on the name ranges object is within the document object, and there is no other side effect. So I think it is safe to do that. ScRangeName* pNames = pDoc->GetRangeName(); -- You are receiving this mail because: You are on the CC list for the bug. You are the assignee for the bug. You are watching all bug changes.
