[Libreoffice-commits] core.git: include/svx svx/source

Noel Grandin (via logerrit) logerrit at kemper.freedesktop.org
Fri Jul 30 15:53:58 UTC 2021


 include/svx/fmsrcimp.hxx     |    8 +++-----
 svx/source/form/fmsrcimp.cxx |    6 +-----
 2 files changed, 4 insertions(+), 10 deletions(-)

New commits:
commit 9edb0f8641b5c01fff57cb5b5c492f3f525d49c8
Author:     Noel Grandin <noel.grandin at collabora.co.uk>
AuthorDate: Fri Jul 30 14:22:41 2021 +0200
Commit:     Noel Grandin <noel.grandin at collabora.co.uk>
CommitDate: Fri Jul 30 17:53:23 2021 +0200

    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 at collabora.co.uk>

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();
 }
 
 


More information about the Libreoffice-commits mailing list