<p>Am 10.12.2015 11:05 schrieb "Luca Olivetti" <<a href="mailto:luca@ventoso.org">luca@ventoso.org</a>>:<br>
><br>
> Hello,<br>
><br>
> in a couple of programs I'm using this idiom:<br>
><br>
><br>
> FMyThread:=TMyTread.Create;<br>
> FMyThread.FreeOnTerminate:=false;<br>
> FMyThread.OnTerminate:=@MyThreadTerminate<br>
><br>
> procedure TMyForm.MyThreadTerminate(Sender:TObject);<br>
> begin<br>
> //do something with FMyThread then<br>
> FreeAndNil(FMyThread);<br>
> end;<br>
><br>
><br>
> With fpc 2.6.4 it worked flawlessly, with fpc 3.0 sometimes it causes a sigsev somewhere inside CheckSynchronize.<br>
><br>
> I could find nothing here<br>
> <a href="http://wiki.freepascal.org/User_Changes_3.0">http://wiki.freepascal.org/User_Changes_3.0</a><br>
> related to this.<br>
> I realize that's an implementation detail so probably what I did was wrong (was it?).</p>
<p>I'd need to check what the RTL does after OnTerminate is called, but it could be that this worked by chance...</p>
<p>> What are the possible solutions (apart from omitting the call to FreeAndNil and setting FreeOnTerminate to true)?</p>
<p>That would be the safest solution (you can set FMyThread to Nil however inside that handler).</p>
<p>Regards,<br>
Sven</p>