Catch exceptions to please coverity

Actually, the possible exception path is from replaceEnvironmentPath.
It would be better if coverity was able to asses that our hardcoded
regexp:s are correct.
This commit is contained in:
Jean-Marc Lasgouttes 2018-01-29 13:50:09 +01:00
parent fc2d8238dc
commit 6b6fa94c91
2 changed files with 14 additions and 6 deletions

View File

@ -483,12 +483,17 @@ int LyX::init(int & argc, char * argv[])
}
// Initialization of LyX (reads lyxrc and more)
LYXERR(Debug::INIT, "Initializing LyX::init...");
bool success = init();
LYXERR(Debug::INIT, "Initializing LyX::init...done");
if (!success)
try {
LYXERR(Debug::INIT, "Initializing LyX::init...");
bool success = init();
LYXERR(Debug::INIT, "Initializing LyX::init...done");
if (!success)
return EXIT_FAILURE;
} catch (exception const &e) {
// This can happen _in_theory_ in replaceEnvironmentPath
lyxerr << "Caught exception `" << e.what() << "'." << endl;
return EXIT_FAILURE;
}
// Remaining arguments are assumed to be files to load.
for (int argi = 1; argi < argc; ++argi)
pimpl_->files_to_load_.push_back(os::utf8_argv(argi));

View File

@ -1067,7 +1067,10 @@ Server::~Server()
string message;
for (int i = 0; i != numclients_; ++i) {
message = "LYXSRV:" + clients_[i] + ":bye\n";
pipes_.send(message);
// ignore exceptions, we are quitting anyway
try {
pipes_.send(message);
} catch (...) {}
}
}