X-Git-Url: https://git.lyx.org/gitweb/?a=blobdiff_plain;f=src%2FServerSocket.cpp;h=3d73a67ed6d955c08318323357856f5ec10aa8f9;hb=6de3c19fd63f810eed90ef3bc4469faf28e949c2;hp=12386af838687a1aef86a4edf1e1d407516b1998;hpb=61b2bd5e7fd9399128342d9048aa814ae5f086fc;p=lyx.git diff --git a/src/ServerSocket.cpp b/src/ServerSocket.cpp index 12386af838..3d73a67ed6 100644 --- a/src/ServerSocket.cpp +++ b/src/ServerSocket.cpp @@ -40,7 +40,6 @@ using namespace std; using namespace lyx::support; -using boost::shared_ptr; namespace lyx { @@ -125,8 +124,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 +142,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);