GENTIT Francois-Xavier DAPNIA writes: > Dear Rooters, > > The following 2 lines of code cause a crash of ROOT when compiled (not in > CINT) : > > > > TArrayD *a = new TArrayD(10); > > delete [] a->fArray; > > > > I have tried them on Linux RedHat with ROOT 3.05.02 and > > On Windows XP, Visual C++.NET, ROOT 3.05.03 > > > > Both cases crash. fArray being public, it should work? Is it a bug or a > feature? Having it public is bad, imo. But anyways, if you are going to delete it this you had probably do what TArrayD does internally: TArrayD *a = new TArrayD(10); delete [] a->fArray; a->fArray = 0; Or, looking at the implementation you could replace those last two lines with: a->Adopt(0,0); -Brett.
This archive was generated by hypermail 2b29 : Thu Jan 01 2004 - 17:50:10 MET