Search code examples
linuxpascalfreepascallazarus

(EAccessViolation) : Access violation while FreeAndNilChild from Owner (LINUX) LAZARUS PASCAL


Im having an acces violation only when hosting a linux server. Windows does not show any issues. This happens when i try to FreeandNilChild Object if OWner , see code. The errors are attached as pictures. Why does this only happen in Linux servers? Am i missing some memory mishandling..could it be GBD version..? Thakns guys appreciated. TWAObject = class(TObject)

destructor TBasePersoneel.Destroy;
 
begin
  FreeAndNilChild(FUser);
  Inherited;
end; 

then

procedure TWAObject.FreeAndNilChild(var obj);
 
Var
  T : TWAObject;
 
begin
  T:=TWAObject(Obj);
  if Assigned(T) and (T.Owner=Self) then
    FreeAndNil(T);
end;

Also getting RunError(216) then the EAccessViolation. The procedure FreeAndNil(var obj); coming from sysinth.inc

Thanks in advance enter image description here enter image description here enter image description here


Solution

  • Thanks for the feedbak, turns out I was freeing twice the same object. For some reason in windows, there was allocating to a correct memory pointer. But in Linux didn't. Thx guys