Hi All,
If I create a new TFx object with the same name like an old one, the TFx constructor which takes a const char *expression does not delete the old object but removes it from the list of functions wheres the TFx constructor which takes a void *fcn deletes the old object.
The code in the first case is (from TFormula::TFormula(const char *name,const char *expression):
TFormula *old = (TFormula*)gROOT->GetListOfFunctions()->FindObject(name);
if (old) {
gROOT->GetListOfFunctions()->Remove(old);
}
And the code in the second case (TF1::TF1(const char *name,const char *formula, Double_t xmin, Double_t xmax)):
TF1 *f1old = (TF1*)gROOT->GetListOfFunctions()->FindObject(name);
if (f1old) delete f1old;
Does that make any sense?
Cheers, Mathias