[Lazarus] SIGSEGV when trying to use a TCustomControl

Leonardo M. Ramé l.rame at griensu.com
Fri Apr 19 15:27:37 CEST 2013


I'm creating a very basic TCustomControl with just a Constructor and its
Destructor.

TMyCustomControl = class(TCustomControl)
public
  constructor Create(TheOwner: TComponent);override;
  destructor Destroy; override; 
end;

In a main form's TForm.Create I'm creating an instance of my
TCustomControl, which is declared as a form variable, like
FMyCustomControl, for example:

constructor TMyForm.FormCreate(Sender: TObject);
begin
  FMyCustomControl := TMyCustomControl.Create(Self);
end;

So far TMyCustomControl's constructor is called, I can debug it, and
it's working ok.

Now, from another method of MyForm, I need to call a method of
TMyCustomControl, but I get a SIGSEGV:

procedure TMyForm.TestCustomControl;
begin
  FMyCustomControl.DoSomething;
end;

Apparently the reference of FMyCustomControl is lost.

I'm missing something?. Should I set or inherit more methods of
TCustomControl to make it work?.

Regards,
-- 
Leonardo M. Ramé
http://leonardorame.blogspot.com




More information about the Lazarus mailing list