[Lazarus] SIGSEGV with Debug only
Daniel Simoes de Ameida
dopidaniel at yahoo.com.br
Fri Mar 30 21:54:39 CEST 2012
Martin,
Even doesn't changing the Owner, the problem still..
O forgot to mention the content of ChangeOwner function
procedure ChangeOwner(AComponente, NewOwner: TComponent);
begin
AComponente.Owner.RemoveComponent(AComponente);
NewOwner.InsertComponent(AComponente);
end;
I suppose this function will handle all Notification changes, isn't ?
[]s Daniel
Conheça o Projeto ACBr - Automaçao Comercial Brasil
DJSystem a Loja Patrocinadora do ACBr
>________________________________
> De: Martin <lazarus at mfriebe.de>
>Para: Daniel Simoes de Ameida <dopidaniel at yahoo.com.br>; Lazarus mailing list <lazarus at lists.lazarus.freepascal.org>
>Enviadas: Sexta-feira, 30 de Março de 2012 13:49
>Assunto: Re: [Lazarus] SIGSEGV with Debug only
>
>
>On 30/03/2012 17:14, Daniel Simoes de Ameida wrote:
>
>>
>>Martin,
>>
>>
>>I use a Tab Style interface... (TDI)... so, I change the Owner/Parent in this function:
>>
>>
....
>
> APage := TFormPage.Create(nbForms) ; // This will call TFormPage.SetAForm
>>
....
>
>
>
>>
>>
>>
>>procedure TFormPage.SetAForm(const AValue : TForm) ;
>>begin
>> fsAForm := AValue ;
>>
>> Caption := fsAForm.Caption;
>> Color := fsAForm.Color;
>>
>> fsAForm.BorderStyle := bsNone ;
>> fsAForm.Align := alClient ;
>>
>> // Change Aform Owner and Parent
>> fsAForm.Parent := Self;
>> ChangeOwner(fsAForm, Self);
>> // AForm.FreeNotification(APage);
>>
>I can't tell you 100% certain if this is related, but there is a
chance it is to do with http://bugs.freepascal.org/view.php?id=21458
>
>Setting the Owner of a component, does call Notify with opRemove
and that breaks the FreeNotification system.
>
>Whenever the LCL sets a component to know about another it uses
FreeNotification. So if one of the 2 is destroyed, the other one is
informed and wiss not attempt to access the destroyed component.
>
>That also happens for anchors(since the 2 anchored components know
about each other, they need to know, if one is destroyed)
>
>Due to the bug I mentioned, if you chang the owner, those
notifications may no longer work. Depending on the order of calls
and who knows whom, that can cause such a crash.
>
>Do you need to change the owner, or can you live with changing the
parent only?
>
>The parent should be enough for displaying it.
>
>One of the things the owner will do, is clean up: if the owner is
destroyed, so is the owned component.
>Maybe you can own things by the application?
> APage := TFormPage.Create(Application) ;
>
>
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lazarus-ide.org/pipermail/lazarus/attachments/20120330/af5f3c09/attachment-0003.html>
More information about the Lazarus
mailing list