Michael Van Canneyt via fpc-pascal said on Sun, 21 May 2023 09:47:15 +0200 (CEST)
>Assuming the result of A is not used outside of Test, the following is >the only solution: > >procedure Test; > >var > A : TObject; >begin > A:=TObject.Create; > Try > // call some code in other unit which raise an exception > DoThis; > finally > A.Free > end; >end; Perhaps there could be one procedure that frees and unwinds everything, since there will probably be more objects that need to be freed, and this procedure could be called by every finally. SteveT Steve Litt Autumn 2022 featured book: Thriving in Tough Times http://www.troubleshooters.com/bookstore/thrive.htm _______________________________________________ fpc-pascal maillist - fpc-pascal@lists.freepascal.org https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal