i'm upgrading from Delphi 2010 to Delphi 10.3.3
if i tried to free an uninitialized object on VCL Project, the application disappear instantly and stay running in the background without showing any error
i know the object should be initialized first i'm just trying to show the problem
i reinstalled Delphi on another PC without editing any settings and got the same behavior
Try Except doesn't help
try this code
procedure TForm1.Button1Click(Sender: TObject);
var
TS:TStringList;
begin
try
TS.Free;
except
end;
end;
X.Freeon a random pointerX, anything can happen. The observed behaviour is a particular example of "anything". But the next time you run the application, something else might happen. And if you run it on another system, again something else might happen. Only if you are lucky will you get an AV. It all depends on the random pointer value...Assigned(X)tests ifXis non-nil. If it is non-nil, it had better point to a valid object instance -- always avoid dangling pointers. IfXis a local variable that is not initialized,Assigned(X)can be eitherTrueorFalse, depending on chance. But in any case, that information is meaningless. You must keep track of your objects yourself. If a constructor doesn't raise an exception, you know the object is constructed. If the constructor raises an exception, it will automatically be freed and you know there is no object.MyFrog := TFrog.Create; try {use the frog} finally MyFrog.Free; end