No, it doesn't still exist. Nothing there created a second object, only several references to the 1 object. So the object freed is the object all refernces pointed to, leaving the references invalid.
HTH, Roger C. Morgan II --- In [email protected], "Dan Statham" <[EMAIL PROTECTED]> wrote: > > Good Morning! > > Delphi 7 Pro. > > Given MySL: TStringList. (a global var) > MyObj := TMyObj.Create; > Add MyObj to the SL > MySL.AddObject('fooname', myobj) > > In another procedure: > LocalMyObj := TMyObj(MySL.Objects[0]); > MySL.Delete(0); > LocalMyObj.Free; > > > My question is: Does the MyObj that was added to the list still > exist on the heap? > Should I have done this: > LocalMyObj := TMyObj(MySL.Objects[0]); > TMyObj(MySL.Objects[0]).Free; > MySL.Delete(0); > LocalMyObj.Free; > > Thanks...Dan'l > ------------------------ Yahoo! Groups Sponsor --------------------~--> Fair play? Video games influencing politics. Click and talk back! http://us.click.yahoo.com/T8sf5C/tzNLAA/TtwFAA/i7folB/TM --------------------------------------------------------------------~-> ----------------------------------------------------- Home page: http://groups.yahoo.com/group/delphi-en/ To unsubscribe: [EMAIL PROTECTED] Yahoo! Groups Links <*> To visit your group on the web, go to: http://groups.yahoo.com/group/delphi-en/ <*> To unsubscribe from this group, send an email to: [EMAIL PROTECTED] <*> Your use of Yahoo! Groups is subject to: http://docs.yahoo.com/info/terms/

