[Libreoffice-commits] core.git: vcl/inc vcl/source
Michael Stahl
mstahl at redhat.com
Fri Sep 22 16:00:07 UTC 2017
vcl/inc/svdata.hxx | 5 +++++
vcl/source/control/field2.cxx | 12 ++++++++----
vcl/source/window/dlgctrl.cxx | 5 +----
3 files changed, 14 insertions(+), 8 deletions(-)
New commits:
commit 8b690f22c9deb6d1171328dfe5607d4c673dc993
Author: Michael Stahl <mstahl at redhat.com>
Date: Fri Sep 22 11:13:39 2017 +0200
vcl: [loplugin:badstatics] xCharClass
There's even 2 of these; move them to struct ImplSVData
which is deleted on shutdown.
Change-Id: I8040cd6f9f31c0a1ab48987a490395f316d52220
Reviewed-on: https://gerrit.libreoffice.org/42630
Tested-by: Jenkins <ci at libreoffice.org>
Reviewed-by: Michael Stahl <mstahl at redhat.com>
diff --git a/vcl/inc/svdata.hxx b/vcl/inc/svdata.hxx
index 65e1c1010b36..a1d6fbb5beb1 100644
--- a/vcl/inc/svdata.hxx
+++ b/vcl/inc/svdata.hxx
@@ -28,6 +28,7 @@
#include <vcl/window.hxx>
#include <com/sun/star/lang/XComponent.hpp>
+#include <com/sun/star/i18n/XCharacterClassification.hpp>
#include "vcleventlisteners.hxx"
#include "impfontcache.hxx"
@@ -361,9 +362,13 @@ struct ImplSVData
std::list< vcl::DeleteOnDeinitBase* >* mpDeinitDeleteList = nullptr;
std::unordered_map< int, OUString >* mpPaperNames = nullptr;
+ css::uno::Reference<css::i18n::XCharacterClassification> m_xCharClass;
+
Link<LinkParamNone*,void> maDeInitHook;
};
+css::uno::Reference<css::i18n::XCharacterClassification> const& ImplGetCharClass();
+
void ImplDeInitSVData();
VCL_PLUGIN_PUBLIC vcl::Window* ImplGetDefaultWindow();
VCL_PLUGIN_PUBLIC vcl::Window* ImplGetDefaultContextWindow();
diff --git a/vcl/source/control/field2.cxx b/vcl/source/control/field2.cxx
index 3712fc004d24..87885679dead 100644
--- a/vcl/source/control/field2.cxx
+++ b/vcl/source/control/field2.cxx
@@ -58,11 +58,15 @@ using namespace ::comphelper;
uno::Reference< i18n::XCharacterClassification > const & ImplGetCharClass()
{
- static uno::Reference< i18n::XCharacterClassification > xCharClass;
- if ( !xCharClass.is() )
- xCharClass = vcl::unohelper::CreateCharacterClassification();
+ ImplSVData *const pSVData = ImplGetSVData();
+ assert(pSVData);
- return xCharClass;
+ if (!pSVData->m_xCharClass.is())
+ {
+ pSVData->m_xCharClass = vcl::unohelper::CreateCharacterClassification();
+ }
+
+ return pSVData->m_xCharClass;
}
static sal_Unicode* ImplAddString( sal_Unicode* pBuf, const OUString& rStr )
diff --git a/vcl/source/window/dlgctrl.cxx b/vcl/source/window/dlgctrl.cxx
index 703b547423ce..6b2ae73ba503 100644
--- a/vcl/source/window/dlgctrl.cxx
+++ b/vcl/source/window/dlgctrl.cxx
@@ -390,10 +390,7 @@ vcl::Window* ImplFindAccelWindow( vcl::Window* pParent, sal_uInt16& rIndex, sal_
sal_uInt16 i = rIndex;
vcl::Window* pWindow;
- // MT: Where can we keep the CharClass?!
- static uno::Reference< i18n::XCharacterClassification > xCharClass;
- if ( !xCharClass.is() )
- xCharClass = vcl::unohelper::CreateCharacterClassification();
+ uno::Reference<i18n::XCharacterClassification> const xCharClass(ImplGetCharClass());
const css::lang::Locale& rLocale = Application::GetSettings().GetUILanguageTag().getLocale();
cCharCode = xCharClass->toUpper( OUString(cCharCode), 0, 1, rLocale )[0];
More information about the Libreoffice-commits
mailing list