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 <[email protected]>
>Para: Daniel Simoes de Ameida <[email protected]>; Lazarus mailing list 
><[email protected]> 
>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) ;  
>
>
>
>
>
--
_______________________________________________
Lazarus mailing list
[email protected]
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus

Reply via email to