Simple IPC stopserver hangs app when threaded
Original Reporter info from Mantis: L505
-
Reporter name: Lars(L505)
Original Reporter info from Mantis: L505
- Reporter name: Lars(L505)
Description:
Am I just dense today or is this a bug? I can't figure out why the application hangs when I stop the simpleipc server.
A simple test case is below with two lazarus buttons on it. Click the first button, everything is okay. Click the second button to stop the server and it hangs. Only if threaded is set to true. A command line program could be built to do similar but would require reading the keyboard events.
Steps to reproduce:
uses simpleipc;
//...
var srv: TSimpleIpcServer;
procedure TForm1.Button1Click(Sender: TObject);
begin
srv := TSimpleIpcServer.Create(nil);
srv.Global := true;
srv.ServerID := '123abc';
srv.StartServer(true);
end;
// when calling this, it causes the app to hang
procedure TForm1.Button2Click(Sender: TObject);
begin
srv.StopServer;
// srv.free; // or this
end;
Additional information:
Tried it in Lazarus 1.6.4
But if this is is a bug it is an fpc bug not lazarus.
But hopefully I'm missing something obvious?
If it is something obvious, should StopServer() check for issues before attempting to stop? It appears to go into a deadlock
Mantis conversion info:
- Mantis ID: 31805
- OS: Windows
- OS Build: 7
- Platform: 32 bit
- Version: 3.0.2
- Fixed in version: 3.1.1
- Fixed in revision: 36915 (#a9819b32)
- Monitored by: » L505 (Lars(L505)), » dezlov (Denis Kozlov)
- Target version: 3.2.0