While running the following code
int main()
{
TApplication app("myapp", 0, 0);
TFile * f = TFile::Open("file.root");
TH1 * histo = (TH1*) f -> Get("histogram");
TCanvas c;
histo -> Draw();
app.Run(kTRUE);
f -> Close();
app.Terminate();
}
I exit from the program by clicking on canvas File
-> "Quit Root"
as prescribed in Return from TApplication when there is no canvas
However, this causes a crash. The reasons are clear - TFile::Close() is called after having exited Root.
How to approach this problem?