[Libreoffice-commits] core.git: Branch 'libreoffice-5-3' - desktop/source
Aron Budea
aron.budea at collabora.com
Tue May 16 09:40:10 UTC 2017
desktop/source/app/app.cxx | 24 +++++++++++++++---------
1 file changed, 15 insertions(+), 9 deletions(-)
New commits:
commit aafb6a75c7461362aceddeadfbf0db0848af866c
Author: Aron Budea <aron.budea at collabora.com>
Date: Sun May 7 01:49:08 2017 +0200
tdf#104312, tdf#105428: use static vars in ReplaceStringHookProc
And use call_once to initialize them once.
Reviewed-on: https://gerrit.libreoffice.org/37318
Tested-by: Jenkins <ci at libreoffice.org>
Reviewed-by: Michael Meeks <michael.meeks at collabora.com>
(cherry picked from commit f9f511317fa5f1c655d189a8507f8a5492a3b08d)
Change-Id: Ic2f97a51ccc6ee400eb1af56da2c8fd88e226a9d
Reviewed-on: https://gerrit.libreoffice.org/37410
Tested-by: Jenkins <ci at libreoffice.org>
Reviewed-by: Miklos Vajna <vmiklos at collabora.co.uk>
diff --git a/desktop/source/app/app.cxx b/desktop/source/app/app.cxx
index 879369714580..1f9307d0c26f 100644
--- a/desktop/source/app/app.cxx
+++ b/desktop/source/app/app.cxx
@@ -23,6 +23,7 @@
#include <sal/config.h>
#include <iostream>
+#include <mutex>
#if defined UNX
#include <signal.h>
#endif
@@ -473,16 +474,17 @@ namespace
OUString ReplaceStringHookProc( const OUString& rStr )
{
- OUString sRet(rStr);
+ const static OUString sBuildId(utl::Bootstrap::getBuildIdData("development"));
+ static OUString sBrandName, sVersion, sAboutBoxVersion, sAboutBoxVersionSuffix, sExtension;
- if (sRet.indexOf("%PRODUCT") != -1 || sRet.indexOf("%ABOUTBOX") != -1)
+ static std::once_flag aInitOnce;
+ std::call_once(aInitOnce, []
{
- OUString sBrandName = BrandName::get();
- OUString sVersion = Version::get();
- OUString sBuildId = utl::Bootstrap::getBuildIdData("development");
- OUString sAboutBoxVersion = AboutBoxVersion::get();
- OUString sAboutBoxVersionSuffix = AboutBoxVersionSuffix::get();
- OUString sExtension = Extension::get();
+ sBrandName = BrandName::get();
+ sVersion = Version::get();
+ sAboutBoxVersion = AboutBoxVersion::get();
+ sAboutBoxVersionSuffix = AboutBoxVersionSuffix::get();
+ sExtension = Extension::get();
if ( sBrandName.isEmpty() )
{
@@ -490,12 +492,16 @@ OUString ReplaceStringHookProc( const OUString& rStr )
sVersion = utl::ConfigManager::getProductVersion();
sAboutBoxVersion = utl::ConfigManager::getAboutBoxProductVersion();
sAboutBoxVersionSuffix = utl::ConfigManager::getAboutBoxProductVersionSuffix();
- if ( sExtension.isEmpty() )
+ if (sExtension.isEmpty())
{
sExtension = utl::ConfigManager::getProductExtension();
}
}
+ } );
+ OUString sRet(rStr);
+ if (sRet.indexOf("%PRODUCT") != -1 || sRet.indexOf("%ABOUTBOX") != -1)
+ {
sRet = sRet.replaceAll( "%PRODUCTNAME", sBrandName );
sRet = sRet.replaceAll( "%PRODUCTVERSION", sVersion );
sRet = sRet.replaceAll( "%BUILDID", sBuildId );
More information about the Libreoffice-commits
mailing list