Skip to content

Commit

Permalink
[thstack] fix copy constructor
Browse files Browse the repository at this point in the history
One have to register THStack in list of cleanups
  • Loading branch information
linev committed Mar 6, 2024
1 parent b551f97 commit 1233705
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions hist/hist/src/THStack.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -347,11 +347,14 @@ THStack::THStack(const THStack &hstack) :
fMaximum(hstack.fMaximum),
fMinimum(hstack.fMinimum)
{
if (hstack.GetHists()) {
TIter next(hstack.GetHists());
TH1 *h;
while ((h=(TH1*)next())) Add(h);
{
R__LOCKGUARD(gROOTMutex);
gROOT->GetListOfCleanups()->Add(this);
}

TIter next(hstack.GetHists());
while (auto h = static_cast<TH1 *>(next()))
Add(h);
}

////////////////////////////////////////////////////////////////////////////////
Expand Down

0 comments on commit 1233705

Please sign in to comment.