Bonjour,
Maybe a CINT feature in compiled code…
I would like to know if there some cases in which after a deleting an object the pointer is not set to NULL.
I have a rather complicated piece of code in which I perform some fits of histograms in a TTree. I create a TF1 from a “standard” fitting routine, and re-use the TF1 for the following events. If the fit fails, I delete the T1F and recall the initial routine.
But my output looks like this:
:
Current pos = 656
Fitting function deleted 0x987b7c8
Current pos = 657
*** Break *** segmentation violation
Generating stack trace…
:
The code generating this looks like this:
if( EdgePos>EDGE_POS_XMIN && EdgePos<EDGE_POS_XMAX ){
....
} else {
delete CollBhEdge_X; // redo next time!
cout << "Fitting function deleted " << CollBhEdge_X << endl;
}
as you can see the delete did not zero the pointer, but did delete the object. During the next loop, having a non zero pointer on a delete object I get the crash.
Do you have any hint ? Should I send a coredump ?
Until I understand what is going on I will zero it by hand, but I feel a bit uncomfortable about the stability of my code.
merci d’avance, Vincent.