i18npool/CustomTarget_collator.mk | 4 +- i18npool/source/collator/collator_unicode.cxx | 2 - vcl/inc/font/OpenTypeFeatureDefinitionList.hxx | 6 ---- vcl/inc/osx/a11yfocustracker.hxx | 6 ---- vcl/osx/a11yfactory.mm | 2 - vcl/osx/a11yfocuslistener.cxx | 2 - vcl/osx/a11yfocustracker.cxx | 6 ++++ vcl/osx/a11ylistener.cxx | 2 - vcl/source/font/FeatureCollector.cxx | 5 +-- vcl/source/font/OpenTypeFeatureDefinitionList.cxx | 6 ++++ vcl/source/treelist/treelistbox.cxx | 1 vcl/source/window/split.cxx | 33 ++++++++++------------ vcl/unx/generic/glyphs/freetype_glyphcache.cxx | 2 - 13 files changed, 37 insertions(+), 40 deletions(-)
New commits: commit bcf601f53ca50460e973a7ad8725aeed33170b2e Author: Noel Grandin <noelgran...@gmail.com> AuthorDate: Thu Nov 18 20:36:58 2021 +0200 Commit: Noel Grandin <noel.gran...@collabora.co.uk> CommitDate: Fri Nov 19 11:35:29 2021 +0100 rtl::Static->thread-safe static in vcl Change-Id: I748c3b5608b76b4b847273856f6b1c66b53aced1 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/125497 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.gran...@collabora.co.uk> diff --git a/vcl/inc/font/OpenTypeFeatureDefinitionList.hxx b/vcl/inc/font/OpenTypeFeatureDefinitionList.hxx index bf4e51c75c39..52dbcfb5b9f0 100644 --- a/vcl/inc/font/OpenTypeFeatureDefinitionList.hxx +++ b/vcl/inc/font/OpenTypeFeatureDefinitionList.hxx @@ -11,7 +11,6 @@ #include <vcl/dllapi.h> #include <vcl/font/Feature.hxx> -#include <rtl/instance.hxx> #include <vector> #include <unordered_map> @@ -35,10 +34,7 @@ public: bool isRequired(sal_uInt32 nFeatureCode); }; -class VCL_DLLPUBLIC OpenTypeFeatureDefinitionList - : public rtl::Static<OpenTypeFeatureDefinitionListPrivate, OpenTypeFeatureDefinitionList> -{ -}; +VCL_DLLPUBLIC OpenTypeFeatureDefinitionListPrivate& OpenTypeFeatureDefinitionList(); } // namespace vcl::font diff --git a/vcl/inc/osx/a11yfocustracker.hxx b/vcl/inc/osx/a11yfocustracker.hxx index 5a979c26c86b..aafa9944de70 100644 --- a/vcl/inc/osx/a11yfocustracker.hxx +++ b/vcl/inc/osx/a11yfocustracker.hxx @@ -23,8 +23,6 @@ #include "keyboardfocuslistener.hxx" -#include <rtl/instance.hxx> - #include <tools/link.hxx> #include <vcl/vclevent.hxx> #include <set> @@ -93,9 +91,7 @@ private: const rtl::Reference< DocumentFocusListener > m_xDocumentFocusListener; }; -struct TheAquaA11yFocusTracker: - rtl::Static<AquaA11yFocusTracker, TheAquaA11yFocusTracker> -{}; +AquaA11yFocusTracker& TheAquaA11yFocusTracker(); /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/osx/a11yfactory.mm b/vcl/osx/a11yfactory.mm index 797a7492d391..560d3f97357a 100644 --- a/vcl/osx/a11yfactory.mm +++ b/vcl/osx/a11yfactory.mm @@ -59,7 +59,7 @@ static bool enabled = false; mdAllWrapper = [ [ [ NSMutableDictionary alloc ] init ] retain ]; // initialize keyboard focus tracker rtl::Reference< AquaA11yFocusListener > listener( AquaA11yFocusListener::get() ); - TheAquaA11yFocusTracker::get().setFocusListener(listener); + TheAquaA11yFocusTracker().setFocusListener(listener); enabled = true; } return mdAllWrapper; diff --git a/vcl/osx/a11yfocuslistener.cxx b/vcl/osx/a11yfocuslistener.cxx index 68eb45a31f20..bae851647e6b 100644 --- a/vcl/osx/a11yfocuslistener.cxx +++ b/vcl/osx/a11yfocuslistener.cxx @@ -42,7 +42,7 @@ AquaA11yFocusListener::AquaA11yFocusListener() : m_focusedObject(nil) id AquaA11yFocusListener::getFocusedUIElement() { if ( nil == m_focusedObject ) { - Reference< XAccessible > xAccessible( TheAquaA11yFocusTracker::get().getFocusedObject() ); + Reference< XAccessible > xAccessible( TheAquaA11yFocusTracker().getFocusedObject() ); try { if( xAccessible.is() ) { Reference< XAccessibleContext > xContext(xAccessible->getAccessibleContext()); diff --git a/vcl/osx/a11yfocustracker.cxx b/vcl/osx/a11yfocustracker.cxx index 000a4f04fd59..9aa3ae9fb733 100644 --- a/vcl/osx/a11yfocustracker.cxx +++ b/vcl/osx/a11yfocustracker.cxx @@ -35,6 +35,12 @@ using namespace ::com::sun::star::accessibility; using namespace ::com::sun::star::uno; +AquaA11yFocusTracker& TheAquaA11yFocusTracker() +{ + static AquaA11yFocusTracker SINGLETON; + return SINGLETON; +} + static vcl::Window * getWindow(const ::VclSimpleEvent *pEvent) { diff --git a/vcl/osx/a11ylistener.cxx b/vcl/osx/a11ylistener.cxx index b8220c07d933..b34d047b3b7b 100644 --- a/vcl/osx/a11ylistener.cxx +++ b/vcl/osx/a11ylistener.cxx @@ -80,7 +80,7 @@ AquaA11yEventListener::notifyEvent( const AccessibleEventObject& aEvent ) if( m_role != AccessibleRole::LIST ) { Reference< XAccessible > xAccessible; if( aEvent.NewValue >>= xAccessible ) - TheAquaA11yFocusTracker::get().setFocusedObject( xAccessible ); + TheAquaA11yFocusTracker().setFocusedObject( xAccessible ); } break; diff --git a/vcl/source/font/FeatureCollector.cxx b/vcl/source/font/FeatureCollector.cxx index 6448860f9998..6cb1b14c52cd 100644 --- a/vcl/source/font/FeatureCollector.cxx +++ b/vcl/source/font/FeatureCollector.cxx @@ -95,15 +95,14 @@ void FeatureCollector::collectForLanguage(hb_tag_t aTableTag, sal_uInt32 nScript for (hb_tag_t aFeatureTag : aFeatureTags) { - if (OpenTypeFeatureDefinitionList::get().isRequired(aFeatureTag)) + if (OpenTypeFeatureDefinitionList().isRequired(aFeatureTag)) continue; m_rFontFeatures.emplace_back(); vcl::font::Feature& rFeature = m_rFontFeatures.back(); rFeature.m_aID = { aFeatureTag, aScriptTag, aLanguageTag }; - FeatureDefinition aDefinition - = OpenTypeFeatureDefinitionList::get().getDefinition(aFeatureTag); + FeatureDefinition aDefinition = OpenTypeFeatureDefinitionList().getDefinition(aFeatureTag); if (aDefinition) { rFeature.m_aDefinition = aDefinition; diff --git a/vcl/source/font/OpenTypeFeatureDefinitionList.cxx b/vcl/source/font/OpenTypeFeatureDefinitionList.cxx index 9c3a0ca6af49..185668ba7f2f 100644 --- a/vcl/source/font/OpenTypeFeatureDefinitionList.cxx +++ b/vcl/source/font/OpenTypeFeatureDefinitionList.cxx @@ -17,6 +17,12 @@ namespace vcl::font { +OpenTypeFeatureDefinitionListPrivate& OpenTypeFeatureDefinitionList() +{ + static OpenTypeFeatureDefinitionListPrivate SINGLETON; + return SINGLETON; +}; + OpenTypeFeatureDefinitionListPrivate::OpenTypeFeatureDefinitionListPrivate() { init(); } void OpenTypeFeatureDefinitionListPrivate::init() diff --git a/vcl/source/treelist/treelistbox.cxx b/vcl/source/treelist/treelistbox.cxx index 8782547f4c92..d1658582c5af 100644 --- a/vcl/source/treelist/treelistbox.cxx +++ b/vcl/source/treelist/treelistbox.cxx @@ -34,7 +34,6 @@ #include <vcl/uitest/uiobject.hxx> #include <sot/formats.hxx> #include <unotools/accessiblestatesethelper.hxx> -#include <rtl/instance.hxx> #include <comphelper/string.hxx> #include <sal/log.hxx> #include <tools/debug.hxx> diff --git a/vcl/source/window/split.cxx b/vcl/source/window/split.cxx index 7c4a31dde9c8..df631b270bbf 100644 --- a/vcl/source/window/split.cxx +++ b/vcl/source/window/split.cxx @@ -27,25 +27,22 @@ #include <vcl/lineinfo.hxx> #include <vcl/settings.hxx> #include <vcl/ptrstyle.hxx> - -#include <rtl/instance.hxx> +#include <vcl/lazydelete.hxx> #include <window.h> namespace { - struct ImplBlackWall - : public rtl::StaticWithInit<Wallpaper, ImplBlackWall> { - Wallpaper operator () () { - return Wallpaper(COL_BLACK); - } - }; - struct ImplWhiteWall - : public rtl::StaticWithInit<Wallpaper, ImplWhiteWall> { - Wallpaper operator () () { - return Wallpaper(COL_LIGHTGRAY); - } - }; + Wallpaper& ImplBlackWall() + { + static vcl::DeleteOnDeinit< Wallpaper > SINGLETON(COL_BLACK); + return *SINGLETON.get(); + } + Wallpaper& ImplWhiteWall() + { + static vcl::DeleteOnDeinit< Wallpaper > SINGLETON(COL_LIGHTGRAY); + return *SINGLETON.get(); + } } // Should only be called from an ImplInit method for initialization or @@ -81,9 +78,9 @@ void Splitter::ImplInit( vcl::Window* pParent, WinBits nWinStyle ) ImplInitHorVer(nWinStyle & WB_HSCROLL); if( GetSettings().GetStyleSettings().GetFaceColor().IsDark() ) - SetBackground( ImplWhiteWall::get() ); + SetBackground( ImplWhiteWall() ); else - SetBackground( ImplBlackWall::get() ); + SetBackground( ImplBlackWall() ); TaskPaneList *pTList = GetSystemWindow()->GetTaskPaneList(); pTList->AddWindow( this ); @@ -662,9 +659,9 @@ void Splitter::DataChanged( const DataChangedEvent& rDCEvt ) if( oldFaceColor.IsDark() != newFaceColor.IsDark() ) { if( newFaceColor.IsDark() ) - SetBackground( ImplWhiteWall::get() ); + SetBackground( ImplWhiteWall() ); else - SetBackground( ImplBlackWall::get() ); + SetBackground( ImplBlackWall() ); } } diff --git a/vcl/unx/generic/glyphs/freetype_glyphcache.cxx b/vcl/unx/generic/glyphs/freetype_glyphcache.cxx index 7a31f981a371..5754e2e6448c 100644 --- a/vcl/unx/generic/glyphs/freetype_glyphcache.cxx +++ b/vcl/unx/generic/glyphs/freetype_glyphcache.cxx @@ -48,8 +48,6 @@ #include FT_SYNTHESIS_H #include FT_TRUETYPE_TABLES_H -#include <rtl/instance.hxx> - #include <vector> // TODO: move file mapping stuff to OSL commit 38ef2cb092100d03fbef2c05a36526802d06ebaf Author: Noel Grandin <noel.gran...@collabora.co.uk> AuthorDate: Fri Nov 19 08:45:09 2021 +0200 Commit: Noel Grandin <noel.gran...@collabora.co.uk> CommitDate: Fri Nov 19 11:35:16 2021 +0100 loplugin:stringliteraldefine in i18npool Change-Id: I8a56d5d6d201ac5ae65dc46ef4838a0e41af587e Reviewed-on: https://gerrit.libreoffice.org/c/core/+/125530 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.gran...@collabora.co.uk> diff --git a/i18npool/CustomTarget_collator.mk b/i18npool/CustomTarget_collator.mk index 4cf7b953573f..6f8f91f1f6f0 100644 --- a/i18npool/CustomTarget_collator.mk +++ b/i18npool/CustomTarget_collator.mk @@ -66,8 +66,8 @@ $(i18npool_CODIR)/lrl_include.hxx : $(SRCDIR)/i18npool/CustomTarget_collator.mk $(SRCDIR)/i18npool/source/collator/data | $(i18npool_CODIR)/.dir $(call gb_Output_announce,$(subst $(WORKDIR)/,,$@),$(true),ECH,1) $(call gb_Trace_StartRange,$(subst $(WORKDIR)/,,$@),ECH) - echo '#define LOCAL_RULE_LANGS "$(sort $(foreach txt,$(i18npool_COTXTS), \ - $(firstword $(subst _, ,$(txt)))))"' > $@ + echo 'constexpr OUStringLiteral LOCAL_RULE_LANGS = u"$(sort $(foreach txt,$(i18npool_COTXTS), \ + $(firstword $(subst _, ,$(txt)))))";' > $@ $(call gb_Trace_EndRange,$(subst $(WORKDIR)/,,$@),ECH) # vim: set noet sw=4 ts=4: diff --git a/i18npool/source/collator/collator_unicode.cxx b/i18npool/source/collator/collator_unicode.cxx index fc99879759e8..8e54892efab4 100644 --- a/i18npool/source/collator/collator_unicode.cxx +++ b/i18npool/source/collator/collator_unicode.cxx @@ -20,10 +20,10 @@ #include <config_locales.h> #include <sal/log.hxx> +#include <rtl/ustrbuf.hxx> #include <lrl_include.hxx> -#include <rtl/ustrbuf.hxx> #include <i18nlangtag/languagetag.hxx> #include <i18nlangtag/languagetagicu.hxx> #include <collator_unicode.hxx>