That's an interesting one. I guess you're talking about something like this?
Try Something := TSomething.Create(nil); X := TX.Create(blah); //for some reason crashes here Y := TY.Create(); Finally FreeAndNil(Something); FreeAndNil(X); FreeAndNil(y); //will throw exception (?) because was never created End; If so then you could just If (something <> nil) then FreeAndNil(something); ?? (apologies for any coding errors, haven't done much Delphi recently) -----Original Message----- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Conor Boyd Sent: Friday, 21 July 2006 2:26 p.m. To: NZ Borland Developers Group - Delphi List Subject: [DUG] Related try..finally question I'm getting the impression here that a lot of people only have a 1:1 relationship between try.finallys and procedures/functions? Sounds a bit dangerous. Should realistically be a try..finally for each object you instantiate in a method. Comments, anyone? C. _______________________________________________ Delphi mailing list [email protected] http://ns3.123.co.nz/mailman/listinfo/delphi _______________________________________________ Delphi mailing list [email protected] http://ns3.123.co.nz/mailman/listinfo/delphi
