[LyX/2.4.x] Initialize client's name in main()
Jean-Marc Lasgouttes
lasgouttes at lyx.org
Tue Sep 10 12:11:10 UTC 2024
commit 2c5f284f895356647cda38d3dccdaa53c984e6ae
Author: Jean-Marc Lasgouttes <lasgouttes at lyx.org>
Date: Mon Sep 9 15:29:39 2024 +0200
Initialize client's name in main()
Initializing clientName at declaration time is not a good idea.
Spotted by Coverity scan.
(cherry picked from commit 3d323412ad5b4d47774de43f985202f20cabd156)
---
src/client/client.cpp | 10 ++++++----
status.24x | 2 ++
2 files changed, 8 insertions(+), 4 deletions(-)
diff --git a/src/client/client.cpp b/src/client/client.cpp
index 0a80107009..02ea67c008 100644
--- a/src/client/client.cpp
+++ b/src/client/client.cpp
@@ -460,8 +460,7 @@ int h(vector<docstring> const &)
}
-docstring clientName =
- from_ascii(to_string(::getppid()) + ">" + to_string(::getpid()));
+docstring clientName;
int n(vector<docstring> const & arg)
{
@@ -710,9 +709,12 @@ int LyXClientApp::run()
int main(int argc, char * argv[])
{
- lyx::lyxerr.setStream(cerr);
+ using namespace lyx;
+ lyxerr.setStream(cerr);
+ cmdline::clientName =
+ from_ascii(to_string(::getppid()) + ">" + to_string(::getpid()));
- lyx::LyXClientApp app(argc, argv);
+ LyXClientApp app(argc, argv);
return app.exec();
}
diff --git a/status.24x b/status.24x
index b9f827e8d2..90d6bdee81 100644
--- a/status.24x
+++ b/status.24x
@@ -141,6 +141,8 @@ What's new
- Fix case where debug information may report all numbers as hexadecimal.
+- Make sure that lyxclient name is initialized properly.
+
* DOCUMENTATION AND LOCALIZATION
More information about the lyx-cvs
mailing list