diff options
-rw-r--r-- | basic/source/classes/errobject.cxx | 8 | ||||
-rw-r--r-- | basic/source/runtime/basrdll.cxx | 10 |
2 files changed, 12 insertions, 6 deletions
diff --git a/basic/source/classes/errobject.cxx b/basic/source/classes/errobject.cxx index b961e16983f7..85423101b827 100644 --- a/basic/source/classes/errobject.cxx +++ b/basic/source/classes/errobject.cxx @@ -17,6 +17,10 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ +#include <sal/config.h> + +#include <mutex> + #include <errobject.hxx> #include <sbxbase.hxx> @@ -195,8 +199,8 @@ SbxErrObject::getErrObject() { SbxVariableRef& rGlobErr = GetSbxData_Impl().m_aGlobErr; { - static osl::Mutex aMutex; - osl::MutexGuard aGuard(aMutex); + static std::mutex aMutex; + std::scoped_lock aGuard(aMutex); if (!rGlobErr) rGlobErr = new SbxErrObject("Err", uno::Any(uno::Reference<vba::XErrObject>(new ErrObject()))); diff --git a/basic/source/runtime/basrdll.cxx b/basic/source/runtime/basrdll.cxx index 29cd292e2bdf..ba94fd7b9d2b 100644 --- a/basic/source/runtime/basrdll.cxx +++ b/basic/source/runtime/basrdll.cxx @@ -18,6 +18,8 @@ */ #include <memory> +#include <mutex> + #include <vcl/svapp.hxx> #include <tools/debug.hxx> #include <vcl/weld.hxx> @@ -44,9 +46,9 @@ struct BasicDLLImpl : public SvRefBase { } static BasicDLLImpl* BASIC_DLL; - static osl::Mutex& getMutex() + static std::mutex& getMutex() { - static osl::Mutex aMutex; + static std::mutex aMutex; return aMutex; } }; @@ -56,7 +58,7 @@ BasicDLLImpl* BasicDLLImpl::BASIC_DLL = nullptr; BasicDLL::BasicDLL() { - osl::MutexGuard aGuard(BasicDLLImpl::getMutex()); + std::scoped_lock aGuard(BasicDLLImpl::getMutex()); if (!BasicDLLImpl::BASIC_DLL) BasicDLLImpl::BASIC_DLL = new BasicDLLImpl; m_xImpl = BasicDLLImpl::BASIC_DLL; @@ -64,7 +66,7 @@ BasicDLL::BasicDLL() BasicDLL::~BasicDLL() { - osl::MutexGuard aGuard(BasicDLLImpl::getMutex()); + std::scoped_lock aGuard(BasicDLLImpl::getMutex()); const bool bLastRef = m_xImpl->GetRefCount() == 1; if (bLastRef) { BasicDLLImpl::BASIC_DLL->xSbxAppData->m_aGlobErr.clear(); |