[fpc-pascal] SIGSEGV in fpc_check_object

Gabor Boros mlnglsts at bgss.hu
Tue Jun 13 21:04:48 CEST 2017


Hi All,

In my Lazarus application I use a TPanel descendant component (TMyPanel) 
which have subpanels (TMySubPanel) which are TPanel descendants also. 
The subpanels accessed through a TList. If add a new subpanel into the 
main panel added to the list with TList.Add if remove a subpanel from it 
remove from the list with TList.Remove then call TMySubPanel.Free. My 
main development platform is x86_64-Linux and the application works like 
a charm. But with the Windows version of the app (cross compiled to 
i386-Win32) got an "Access violation." at TMySubPanel.Free. If start 
with gdb got "Program received signal SIGSEGV, Segmentation fault.
0x004041c4 in fpc_check_object ()" at TMySubPanel.Free.

I completely don't understand what is the source of the problem and why 
the two platforms behaves differently.

Cannot have a simple test case just a dumb example.

procedure TForm1.FormCreate(Sender: TObject);
var
   x:TPanel;

begin
   x.Free;
end;

With Linux no error (x is Nil before the Free call), with Windows got 
SIGSEGV (x is not Nil before the Free call). Is it a Lazarus thing or 
come from FPC?

Gabor



More information about the fpc-pascal mailing list