Am 10.12.2015 11:05 schrieb "Luca Olivetti" <l...@ventoso.org>:
>
> Hello,
>
> in a couple of programs I'm using this idiom:
>
>
> FMyThread:=TMyTread.Create;
> FMyThread.FreeOnTerminate:=false;
> FMyThread.OnTerminate:=@MyThreadTerminate
>
> procedure TMyForm.MyThreadTerminate(Sender:TObject);
> begin
>   //do something with FMyThread then
>   FreeAndNil(FMyThread);
> end;
>
>
> With fpc 2.6.4 it worked flawlessly, with fpc 3.0 sometimes it causes a
sigsev somewhere inside CheckSynchronize.
>
> I could find nothing here
> http://wiki.freepascal.org/User_Changes_3.0
> related to this.
> I realize that's an implementation detail so probably what I did was
wrong (was it?).

I'd need to check what the RTL does after OnTerminate is called, but it
could be that this worked by chance...

> What are the possible solutions (apart from omitting the call to
FreeAndNil and setting FreeOnTerminate to true)?

That would be the safest solution (you can set FMyThread to Nil however
inside that handler).

Regards,
Sven
_______________________________________________
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal

Reply via email to