diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2021-07-30 14:22:41 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2021-07-30 17:53:23 +0200 |
commit | 9edb0f8641b5c01fff57cb5b5c492f3f525d49c8 (patch) | |
tree | dd03846db731dd3e9cce4db285db3da1ce1c5d07 | |
parent | 1119f5fb482c82124f99bbeffe6b507a377247de (diff) |
osl::Mutex->std::atomic in FmSearchEngine
Change-Id: Ie056215227ce19efcb28518f6a510bed5b15b93d
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/119705
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
-rw-r--r-- | include/svx/fmsrcimp.hxx | 8 | ||||
-rw-r--r-- | svx/source/form/fmsrcimp.cxx | 6 |
2 files changed, 4 insertions, 10 deletions
diff --git a/include/svx/fmsrcimp.hxx b/include/svx/fmsrcimp.hxx index 68cd77b17fe2..1c9d55829e69 100644 --- a/include/svx/fmsrcimp.hxx +++ b/include/svx/fmsrcimp.hxx @@ -26,11 +26,11 @@ #include <com/sun/star/beans/XPropertyChangeListener.hpp> #include <cppuhelper/implbase.hxx> -#include <osl/mutex.hxx> #include <unotools/charclass.hxx> #include <unotools/collatorwrapper.hxx> #include <tools/link.hxx> +#include <atomic> #include <deque> #include <memory> #include <string_view> @@ -193,12 +193,10 @@ class SAL_WARN_UNUSED SVX_DLLPUBLIC FmSearchEngine final // The link we broadcast the progress and the result to Link<const FmSearchProgress*,void> m_aProgressHandler; - bool m_bSearchingCurrently : 1; // is an (asynchronous) search running? - bool m_bCancelAsynchRequest : 1; // should be cancelled? - ::osl::Mutex m_aCancelAsynchAccess; // access to_bCancelAsynchRequest (technically only - // relevant for m_eMode == SM_USETHREAD) + std::atomic<bool> m_bCancelAsynchRequest; // should be cancelled? // parameters for the search + bool m_bSearchingCurrently : 1; // is an (asynchronous) search running? bool m_bFormatter : 1; // use field formatting bool m_bForward : 1; // direction bool m_bWildcard : 1; // wildcard search diff --git a/svx/source/form/fmsrcimp.cxx b/svx/source/form/fmsrcimp.cxx index 60613663eda5..eb292abd8ce4 100644 --- a/svx/source/form/fmsrcimp.cxx +++ b/svx/source/form/fmsrcimp.cxx @@ -547,8 +547,8 @@ FmSearchEngine::FmSearchEngine(const Reference< XComponentContext >& _rxContext, ,m_xClonedIterator(m_xOriginalIterator, true) ,m_eSearchForType(SearchFor::String) ,m_srResult(SearchResult::Found) - ,m_bSearchingCurrently(false) ,m_bCancelAsynchRequest(false) + ,m_bSearchingCurrently(false) ,m_bFormatter(true) // this must be consistent with m_xSearchCursor, which is generally == m_xOriginalIterator ,m_bForward(false) ,m_bWildcard(false) @@ -915,18 +915,14 @@ IMPL_LINK(FmSearchEngine, OnNewRecordCount, sal_Int32, theCounter, void) bool FmSearchEngine::CancelRequested() { - m_aCancelAsynchAccess.acquire(); bool bReturn = m_bCancelAsynchRequest; - m_aCancelAsynchAccess.release(); return bReturn; } void FmSearchEngine::CancelSearch() { - m_aCancelAsynchAccess.acquire(); m_bCancelAsynchRequest = true; - m_aCancelAsynchAccess.release(); } |