[LyX/master] Initialize client's name in main()

Jean-Marc Lasgouttes lasgouttes at lyx.org
Mon Sep 9 15:58:10 UTC 2024


Le 09/09/2024 à 15:33, Jean-Marc Lasgouttes a écrit :
> commit 3d323412ad5b4d47774de43f985202f20cabd156
> 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.

This is also useful to backport IMO.

JMarc
>      
>      Spotted by Coverity scan.
> ---
>   src/client/client.cpp | 10 ++++++----
>   1 file changed, 6 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();
>   }
>   



More information about the lyx-cvs mailing list