mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-12-22 05:16:21 +00:00
Fix bug #8170: Crash when client disconnects unexpectedly
When the socket does not exist anymore, we should not try to access it. In trying to do so, std::map will create a new shared_ptr but this pointer doesn't point at anything. To prevent this, we explicitly check whether the socket is available.
This commit is contained in:
parent
3476a6f1d4
commit
4c3a97d96e
@ -125,8 +125,10 @@ void ServerSocket::serverCallback()
|
||||
// if the connection has been closed
|
||||
void ServerSocket::dataCallback(int fd)
|
||||
{
|
||||
shared_ptr<LyXDataSocket> client = clients[fd];
|
||||
|
||||
map<int, shared_ptr<LyXDataSocket> >::const_iterator it = clients.find(fd);
|
||||
if (it == clients.end())
|
||||
return;
|
||||
shared_ptr<LyXDataSocket> client = it->second;
|
||||
string line;
|
||||
size_t pos;
|
||||
bool saidbye = false;
|
||||
|
Loading…
Reference in New Issue
Block a user