The stack seems odd. Could you run within the debugger and send its stack trace.
I think that the problem is doing:delete qev;
delete t; is the cause of the problem. Because
of your ‘qev=0’, the Tree owns the object and probably
deletes is a second case.
In addition the tree is owned by the TFile, so you do
not have to delete it (but deleting it is okay).
Use:
fin=new TFile(filename, "read");
if (fin->IsOpen()) {
t=(TTree*)fin->Get("T");
qev=0;
t->SetBranchAddress("Events", &qev);
}
delete fin;
Cheers,
Philippe
Also doing:qev=new QEvent();
qev=0; is a memory leak. Just do one of the other.
In cint, the “delete” will set qev and t to 0, but “delete fin” will crash. If I do NOT delete qev and t, “delete fin” will work fine. However, if I compile the code and run the executable, the “delete fin” crash no matter whether I delete qev and t or not.