diff options
author | Noel Grandin <noelgrandin@gmail.com> | 2021-11-08 21:01:19 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2021-11-09 08:28:56 +0100 |
commit | b3c6b3a274b4c89d3572010794897c65b26571aa (patch) | |
tree | 87493b0306663ac6c818a71df9f83831914e296b /basic/source/classes | |
parent | 926ac3c5e4b8eb425bc2db0366594acc0cf2c1ed (diff) |
rtl::Static to thread-safe static
Change-Id: I35e2a252708228bdbeaee557ef35763c64608653
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/124884
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'basic/source/classes')
-rw-r--r-- | basic/source/classes/codecompletecache.cxx | 31 | ||||
-rw-r--r-- | basic/source/classes/sbunoobj.cxx | 1 |
2 files changed, 17 insertions, 15 deletions
diff --git a/basic/source/classes/codecompletecache.cxx b/basic/source/classes/codecompletecache.cxx index e2993c28581a..8f03797c32dd 100644 --- a/basic/source/classes/codecompletecache.cxx +++ b/basic/source/classes/codecompletecache.cxx @@ -19,13 +19,16 @@ #include <basic/codecompletecache.hxx> #include <iostream> -#include <rtl/instance.hxx> #include <officecfg/Office/BasicIDE.hxx> #include <officecfg/Office/Common.hxx> namespace { - class theCodeCompleteOptions: public ::rtl::Static< CodeCompleteOptions, theCodeCompleteOptions >{}; +CodeCompleteOptions& theCodeCompleteOptions() +{ + static CodeCompleteOptions SINGLETON; + return SINGLETON; +} } CodeCompleteOptions::CodeCompleteOptions() @@ -40,62 +43,62 @@ CodeCompleteOptions::CodeCompleteOptions() bool CodeCompleteOptions::IsCodeCompleteOn() { - return officecfg::Office::Common::Misc::ExperimentalMode::get() && theCodeCompleteOptions::get().bIsCodeCompleteOn; + return officecfg::Office::Common::Misc::ExperimentalMode::get() && theCodeCompleteOptions().bIsCodeCompleteOn; } void CodeCompleteOptions::SetCodeCompleteOn( bool b ) { - theCodeCompleteOptions::get().bIsCodeCompleteOn = b; + theCodeCompleteOptions().bIsCodeCompleteOn = b; } bool CodeCompleteOptions::IsExtendedTypeDeclaration() { - return officecfg::Office::Common::Misc::ExperimentalMode::get() && theCodeCompleteOptions::get().bExtendedTypeDeclarationOn; + return officecfg::Office::Common::Misc::ExperimentalMode::get() && theCodeCompleteOptions().bExtendedTypeDeclarationOn; } void CodeCompleteOptions::SetExtendedTypeDeclaration( bool b ) { - theCodeCompleteOptions::get().bExtendedTypeDeclarationOn = b; + theCodeCompleteOptions().bExtendedTypeDeclarationOn = b; } bool CodeCompleteOptions::IsProcedureAutoCompleteOn() { - return officecfg::Office::Common::Misc::ExperimentalMode::get() && theCodeCompleteOptions::get().bIsProcedureAutoCompleteOn; + return officecfg::Office::Common::Misc::ExperimentalMode::get() && theCodeCompleteOptions().bIsProcedureAutoCompleteOn; } void CodeCompleteOptions::SetProcedureAutoCompleteOn( bool b ) { - theCodeCompleteOptions::get().bIsProcedureAutoCompleteOn = b; + theCodeCompleteOptions().bIsProcedureAutoCompleteOn = b; } bool CodeCompleteOptions::IsAutoCloseQuotesOn() { - return officecfg::Office::Common::Misc::ExperimentalMode::get() && theCodeCompleteOptions::get().bIsAutoCloseQuotesOn; + return officecfg::Office::Common::Misc::ExperimentalMode::get() && theCodeCompleteOptions().bIsAutoCloseQuotesOn; } void CodeCompleteOptions::SetAutoCloseQuotesOn( bool b ) { - theCodeCompleteOptions::get().bIsAutoCloseQuotesOn = b; + theCodeCompleteOptions().bIsAutoCloseQuotesOn = b; } bool CodeCompleteOptions::IsAutoCloseParenthesisOn() { - return officecfg::Office::Common::Misc::ExperimentalMode::get() && theCodeCompleteOptions::get().bIsAutoCloseParenthesisOn; + return officecfg::Office::Common::Misc::ExperimentalMode::get() && theCodeCompleteOptions().bIsAutoCloseParenthesisOn; } void CodeCompleteOptions::SetAutoCloseParenthesisOn( bool b ) { - theCodeCompleteOptions::get().bIsAutoCloseParenthesisOn = b; + theCodeCompleteOptions().bIsAutoCloseParenthesisOn = b; } bool CodeCompleteOptions::IsAutoCorrectOn() { - return officecfg::Office::Common::Misc::ExperimentalMode::get() && theCodeCompleteOptions::get().bIsAutoCorrectOn; + return officecfg::Office::Common::Misc::ExperimentalMode::get() && theCodeCompleteOptions().bIsAutoCorrectOn; } void CodeCompleteOptions::SetAutoCorrectOn( bool b ) { - theCodeCompleteOptions::get().bIsAutoCorrectOn = b; + theCodeCompleteOptions().bIsAutoCorrectOn = b; } std::ostream& operator<< (std::ostream& aStream, const CodeCompleteDataCache& aCache) diff --git a/basic/source/classes/sbunoobj.cxx b/basic/source/classes/sbunoobj.cxx index f9d378ea8865..9e1d31fb4ac1 100644 --- a/basic/source/classes/sbunoobj.cxx +++ b/basic/source/classes/sbunoobj.cxx @@ -32,7 +32,6 @@ #include <comphelper/processfactory.hxx> #include <cppuhelper/weakref.hxx> -#include <rtl/instance.hxx> #include <rtl/math.hxx> #include <rtl/ustrbuf.hxx> |