Skip to content

Commit

Permalink
Set the kNotGlobal bit when removing a TF1 from the global list.
Browse files Browse the repository at this point in the history
This avoids spurrious warning about inconsitent state in the case where multiple thread create (for fitting)
multiple function with the same name and remove them 'concurrently' with AddToGlobalList(false).
  • Loading branch information
pcanal committed Apr 17, 2017
1 parent f46197a commit af59257
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion hist/hist/src/TF1.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -629,6 +629,9 @@ void TF1::DoInitialize(EAddToList addToGlobalList)
// Store formula in linked list of formula in ROOT
TF1 *f1old = (TF1 *)gROOT->GetListOfFunctions()->FindObject(fName);
gROOT->GetListOfFunctions()->Remove(f1old);
// We removed f1old from the list, it is not longer global.
// (See TF1::AddToGlobalList which requires this flag to be correct).
f1old->SetBit(kNotGlobal, kTRUE);
gROOT->GetListOfFunctions()->Add(this);
} else
SetBit(kNotGlobal, kTRUE);
Expand Down Expand Up @@ -671,7 +674,7 @@ Bool_t TF1::AddToGlobalList(Bool_t on)
}
// do I need to delete previous one with the same name ???
//TF1 * old = dynamic_cast<TF1*>( gROOT->GetListOfFunctions()->FindObject(GetName()) );
//if (old) gROOT->GetListOfFunctions()->Remove(old);
//if (old) { gROOT->GetListOfFunctions()->Remove(old); old->SetBit(kNotGlobal, kTRUE); }
R__LOCKGUARD2(gROOTMutex);
gROOT->GetListOfFunctions()->Add(this);
SetBit(kNotGlobal, kFALSE);
Expand Down

2 comments on commit af59257

@smuzaffar
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@pcanal , can you please include this for root v6-08-00-patches

@pcanal
Copy link
Member Author

@pcanal pcanal commented on af59257 May 16, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@smuzaffar done.

Please sign in to comment.