andrea-magni / TFrameStand

TFrameStand and TFormStand components for Delphi FireMonkey (FMX)
Mozilla Public License 2.0
263 stars 78 forks source link

Freeing correctly TFormInfo when removed in destructor #87

Open spinettaro opened 6 months ago

spinettaro commented 6 months ago

Once removed during the destructor the form needs to be freed

spinettaro commented 5 months ago

Ciao Andrea! Sorry for the late response :) What I'm experiencing is a Memory leak when I close the application. I'm testing the application with Win32 configuration. I can also create a simple project if you need it but here you can see the simple steps to reproduce it:

Expected Result:

Actual Result:

Let me know

spinettaro commented 5 months ago

oh sorry I missed a piece, I think that is the old code I committed for merge. I think the issue is that there is no check when the Form is created by TFormStand, then the lines you suggested should add a check if the form is owned by LInfo:

{$IFDEF AUTOREFCOUNT}
  LInfo.DisposeOf;
  LInfo := nil;
{$ELSE}
  if LInfo.FormIsOwned then LInfo.Form.Free;
  LInfo.Free;
{$ENDIF}

or create a specific destructor for it