formally what you do is not correct C++. f is first defined as
a pointer to a TFile and then in the same scope it is redefined
as a TFile. However, I agree that a crash is not really friendly,
especially for an interactive environment. Masaharu what is your
opinion? Maybe you could protect this?
Anyway, to clean the global scope use gROOT->Reset() just after
the delete f and it will work.
Cheers, Fons.
Jarek Grebieszkow wrote:
>
> Hi again,
> so this is not again about TTree I have solved my problem this is about
> another Cint feature, such small program does the root crash:
>
> root [0] TFile *f = new TFile("out.root");
> root [1] delete f;
> root [2] TFile f("out.root");
>
> *** Break *** segmentation violation
>
> I think Cint should print error/warning at least.
>
> Regards
> Jarek
-- Org: CERN, European Laboratory for Particle Physics. Mail: 1211 Geneve 23, Switzerland Phone: +41 22 7679248 E-Mail: Fons.Rademakers@cern.ch Fax: +41 22 7822601