Skip to content

Commit

Permalink
[thstack] delete in destructor all objects
Browse files Browse the repository at this point in the history
Even when fHists is nullptr some other objects may be there
  • Loading branch information
linev committed Mar 6, 2024
1 parent e37a7ec commit b551f97
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions hist/hist/src/THStack.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -321,16 +321,15 @@ THStack::THStack(TH1* hist, Option_t *axis /*="x"*/,

THStack::~THStack()
{

{
R__LOCKGUARD(gROOTMutex);
gROOT->GetListOfCleanups()->Remove(this);
}
if (!fHists) return;

fHists->Clear("nodelete");
delete fHists;
fHists = nullptr;
if (fHists) {
fHists->Clear("nodelete");
delete fHists;
fHists = nullptr;
}
if (fStack) {
fStack->Delete();
delete fStack;
Expand Down

0 comments on commit b551f97

Please sign in to comment.