Hi
Sorry for delay in replying weekends is my normal time to develops apps.
This issue is getting very strange, I have managed to stop any errors on exit on OSX (changed richmemo component for a standard tmemo) and that solved the issue on OSX.
The same code however is not working the same on Windows.
After trying all kinds of debug stuff, eventually I used lazlogger in the close event of the form and then I noticed that the issue is after the close event has finished; it runs through all the lines of the close event and then now I have managed to get some further most odd debug info.
Where it is giving the sigsev is actually in the form.destroy.
If I hover over the Name variable it shows the name of my Application Form as the problem.
destructor TControl.Destroy;
var
HandlerType: TControlHandlerType;
Side: TAnchorKind;
i: Integer;
CurAnchorSide: TAnchorSide;
begin
//DebugLn('[TControl.Destroy] A ',Name,':',ClassName); <---- Holding cursor over the name I get the name of my Application Form
// make sure the capture is released
MouseCapture := False;
// explicit notification about component destruction. this can be a drag target
DragManager.Notification(Self, opRemove);
Application.ControlDestroyed(Self);
if (FHostDockSite <> nil) and not (csDestroying in FHostDockSite.ComponentState) then
begin
FHostDockSite.DoUndockClientMsg(nil, Self);
SetParent(nil);
Dock(nil, BoundsRect);
FHostDockSite := nil;
end else
begin
if Assigned(FHostDockSite) and Assigned(FHostDockSite.FDockClients) then
begin
FHostDockSite.FDockClients.Remove(Self);
FHostDockSite := nil;
end;
SetParent(nil);
end;
if FAnchoredControls <> nil then
begin
for i := 0 to FAnchoredControls.Count - 1 do
for Side := Low(TAnchorKind) to High(TAnchorKind) do
begin
CurAnchorSide := AnchoredControls[i].AnchorSide[Side];
if (CurAnchorSide<>nil) and (CurAnchorSide.FControl = Self) then
CurAnchorSide.FControl := nil;
end;
FreeThenNil(FAnchoredControls);
end;
FreeThenNil(FActionLink);
for Side := Low(FAnchorSides) to High(FAnchorSides) do
FreeThenNil(FAnchorSides[Side]);
FreeThenNil(FBorderSpacing);
FreeThenNil(FConstraints);
FreeThenNil(FFont);
FreeThenNil(FAccessibleObject);
//DebugLn('[TControl.Destroy] B ',DbgSName(Self));
inherited Destroy; <-------- Here it is showing the problem.
//DebugLn('[TControl.Destroy] END ',DbgSName(Self));
for HandlerType := Low(TControlHandlerType) to High(TControlHandlerType) do
FreeThenNil(FControlHandlers[HandlerType]);
{$IFDEF DebugDisableAutoSizing}
FreeAndNil(FAutoSizingLockReasons);
{$ENDIF}
end;