Hi Victor, > > delete list; > this does not delete any objects (in heap or not) > > list->Delete(); > delete list; I thought it will, due to SetOwner... Thomas. > > { > > TList *list = new TList; > > MyClass a; > > MyClass *b = new MyClass; > > list.Add(&a); > > list.Add(b); > > list->SetOwner(); > > [...] > > delete list; > > } > > > > is correct code and does no segfault? > > > > Regards, > > Thomas. > > > > > With > > > - MyClass *c = new MyClass(); c is on the heap > > > - MyClass c; c is in the stack > > > > > > > Something I never understood... When is a object 'on the heap'? > > -- > Victor M. Perevoztchikov perev@bnl.gov perev@vxcern.cern.ch > Brookhaven National Laboratory MS 510A PO Box 5000 Upton NY 11973-5000 > tel office : 631-344-7894; fax 631-344-4206; home 631-345-2690 > ----- Würden Sie Windows 95 die Kontrolle eines AKWs überlassen? Hiroshima '45...! Tschernobyl '86...!! Windows 95...!!! Unix ist benutzerfreundlich - es ist nur etwas wählerisch..." (Walter Misar) Was sagt ein arbeitsloser Physiker zu einem Physiker mit Arbeit? - "Eine Currywurst mit Pommes bitte!"
This archive was generated by hypermail 2b29 : Tue Jan 01 2002 - 17:51:06 MET