X-Git-Url: https://git.lyx.org/gitweb/?a=blobdiff_plain;f=src%2FServerSocket.cpp;h=4c34212cb52b597f55e7793974392299abca0053;hb=5170489b983c08c8be8d878996710eb0f6db2679;hp=9b19a57315ae8a117363ea243c2c4e0d6e6ad1a2;hpb=c9b9748cee687e709e9e48dd2c78e054d8ea29a3;p=lyx.git diff --git a/src/ServerSocket.cpp b/src/ServerSocket.cpp index 9b19a57315..4c34212cb5 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 client = clients[fd]; - + map >::const_iterator it = clients.find(fd); + if (it == clients.end()) + return; + shared_ptr client = it->second; string line; size_t pos; bool saidbye = false; @@ -141,8 +143,10 @@ void ServerSocket::dataCallback(int fd) string const key = line.substr(0, pos); if (key == "LYXCMD") { string const cmd = line.substr(pos + 1); + FuncRequest fr(lyxaction.lookupFunc(cmd)); + fr.setOrigin(FuncRequest::LYXSERVER); DispatchResult dr; - theApp()->dispatch(lyxaction.lookupFunc(cmd), dr); + theApp()->dispatch(fr, dr); string const rval = to_utf8(dr.message()); if (dr.error()) client->writeln("ERROR:" + cmd + ':' + rval);