The branch, master, has been updated. - Log -----------------------------------------------------------------
commit 4c3a97d96e478dd54ee2a10205fc2520c33c6fda Author: Vincent van Ravesteijn <[email protected]> Date: Thu May 24 13:55:41 2012 +0200 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. diff --git a/src/ServerSocket.cpp b/src/ServerSocket.cpp index 7b9d6df..4c34212 100644 --- a/src/ServerSocket.cpp +++ b/src/ServerSocket.cpp @@ -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; ----------------------------------------------------------------------- Summary of changes: src/ServerSocket.cpp | 6 ++++-- 1 files changed, 4 insertions(+), 2 deletions(-) hooks/post-receive -- The LyX Source Repository
