Sorry, I have created confusion with what I posted. I always try to solve a problem myself so have tried lots of combinations before the particular combination in that block of source. The last variant was the one I copied and pasted. The original had the SimpleIPC created in OnCreate and freed in OnDestroy.
The thing that stops the problem is turning off threading in the SimpleIPC server, its absolutely not about where the server is created or freed.
It also does not hang if the free-ing happens in the same function as create. Not useful but demonstrates something ? What ? To be absolutely clear, this does not work either -
procedure TForm1.FormCreate(Sender: TObject);
begin
CommsServer := TSimpleIPCServer.Create(Nil);
CommsServer.ServerID:='my-sipc-test';
CommsServer.Global:=True;
CommsServer.StartServer(true); // start listening, threaded
end;
procedure TForm1.FormDestroy(Sender: TObject);
begin
CommsServer.stopserver;
CommsServer.Free;
end;
Set threading off { CommsServer.StartServer(false); } and its all good. Appears the threading is incompatible with the Lazarus GUI loop ?
(Note - Linux requires you to define USECTHREADS in the lpr file.)
Davo