<html>
<head>
<meta content="text/html; charset=ISO-8859-1"
http-equiv="Content-Type">
</head>
<body bgcolor="#FFFFFF" text="#000000">
On 30/03/2012 17:14, Daniel Simoes de Ameida wrote:
<blockquote
cite="mid:1333124040.83015.YahooMailNeo@web161401.mail.bf1.yahoo.com"
type="cite">
<div style="color: rgb(0, 0, 0); background-color: rgb(255, 255,
255); font-family: Courier
New,courier,monaco,monospace,sans-serif; font-size: 10pt;"><br>
<div>Martin,</div>
<div><br>
</div>
<div> I use a <a moz-do-not-send="true"
href="http://blog.djsystem.com.br/">Tab Style interface</a>...
(TDI)... so, I change the Owner/Parent in this function:</div>
<div><br>
</div>
</div>
</blockquote>
....<br>
<blockquote type="cite"> APage :=
TFormPage.Create(nbForms) ; // This will call TFormPage.SetAForm<br>
</blockquote>
....<br>
<br>
<blockquote
cite="mid:1333124040.83015.YahooMailNeo@web161401.mail.bf1.yahoo.com"
type="cite">
<div style="color:#000; background-color:#fff; font-family:Courier
New, courier, monaco, monospace, sans-serif;font-size:10pt"><br>
<div><br>
</div>
<div>procedure TFormPage.SetAForm(const AValue : TForm) ;<br>
begin<br>
fsAForm := AValue ;<br>
<br>
Caption := fsAForm.Caption;<br>
Color := fsAForm.Color;<br>
<br>
fsAForm.BorderStyle := bsNone ; <br>
fsAForm.Align := alClient ; <br>
<br>
// Change Aform Owner and Parent<br>
fsAForm.Parent := Self;<br>
ChangeOwner(fsAForm, Self);<br>
// AForm.FreeNotification(APage);<br>
</div>
</div>
</blockquote>
<br>
I can't tell you 100% certain if this is related, but there is a
chance it is to do with
<a class="moz-txt-link-freetext" href="http://bugs.freepascal.org/view.php?id=21458">http://bugs.freepascal.org/view.php?id=21458</a><br>
<br>
Setting the Owner of a component, does call Notify with opRemove
and that breaks the FreeNotification system.<br>
<br>
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.<br>
<br>
That also happens for anchors(since the 2 anchored components know
about each other, they need to know, if one is destroyed)<br>
<br>
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.<br>
<br>
Do you need to change the owner, or can you live with changing the
parent only?<br>
<br>
The parent should be enough for displaying it.<br>
<br>
One of the things the owner will do, is clean up: if the owner is
destroyed, so is the owned component.<br>
Maybe you can own things by the application?<br>
APage := TFormPage.Create(Application) ; <br>
<br>
<br>
</body>
</html>