Dear all,
According to the ROOT reference guide, when you have a TObjArray which is owner of its own objects, the call to the destructor of the TObjArray is enough to delete also its objects. Why, then, the pointer to the object is still not null after that (even if not valid)? E.g.:
root [0] TObjArray* a = new TObjArray() root [1] a->SetOwner(1) -----------> OWNER = TRUE root [2] TH1F* h0 = new TH1F("h0","h0",10,0,10) root [3] h0->Fill(2)
root [6] a->Add(h0) root [7] h0->GetEntries()root [9] h0
(const Double_t)3.00000000000000000e+00
root [8] delete a ----------> DESTROYING THE TOBJARRAY
I am asking this because in some piece of code, I do exactly that (declaring the TObjArray as owner of its object, and then NOT calling TObjArray::Delete(), but only the destructor), but I am not 100% now that this is enough.
Thanks for your help.
Regards,
Chiara Received on Mon Jul 25 2011 - 09:06:33 CEST
This archive was generated by hypermail 2.2.0 : Mon Jul 25 2011 - 11:50:01 CEST