Skip to content

Commit c061179

Browse files
author
Petr Jacka
committed
[hist] Fix THnSparseD copy constructor; make deep copy of fBinContent
1 parent 705fea9 commit c061179

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

hist/hist/src/THnSparse.cxx

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -649,10 +649,13 @@ THnBase(name, title, dim, nbins, xbins),
649649

650650
THnSparse::THnSparse(const THnSparse& other):
651651
THnBase(other), fChunkSize(other.fChunkSize), fFilledBins(other.fFilledBins),
652-
fBinContent(other.fBinContent), fBins(other.fBins), fBinsContinued(other.fBinsContinued),
652+
fBins(other.fBins), fBinsContinued(other.fBinsContinued),
653653
fCompactCoord(nullptr) {
654654

655-
fBinContent.SetOwner();
655+
TObjArray* copiedContent = (TObjArray*)other.fBinContent.Clone();
656+
fBinContent = *copiedContent;
657+
copiedContent->SetOwner(kFALSE);
658+
delete copiedContent;
656659

657660
Int_t dim = other.GetNdimensions();
658661
auto nbins=new Int_t[dim];

0 commit comments

Comments
 (0)