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

Caolán McNamara (via logerrit) logerrit at kemper.freedesktop.org
Tue May 5 13:37:43 UTC 2020


 include/svl/style.hxx             |    3 ++-
 svl/source/items/style.cxx        |    5 +++++
 sw/source/uibase/app/docstyle.cxx |    3 ++-
 3 files changed, 9 insertions(+), 2 deletions(-)

New commits:
commit 4ce4d8e0d64867a47a8c7355894f6ae3d576db6d
Author:     Caolán McNamara <caolanm at redhat.com>
AuthorDate: Tue May 5 12:14:37 2020 +0100
Commit:     Caolán McNamara <caolanm at redhat.com>
CommitDate: Tue May 5 15:37:02 2020 +0200

    we want to invalidate the current iterator
    
    if there isn't one we shouldn't need to create one to invalidate it
    
    Change-Id: Ia936f71c18c45d8e08f013ffa143c196109495ed
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/93471
    Tested-by: Jenkins
    Reviewed-by: Caolán McNamara <caolanm at redhat.com>

diff --git a/include/svl/style.hxx b/include/svl/style.hxx
index 85be6cc124ba..3a35531d2d68 100644
--- a/include/svl/style.hxx
+++ b/include/svl/style.hxx
@@ -230,8 +230,9 @@ friend class SfxStyleSheetBase;
 
     std::unique_ptr<SfxStyleSheetBasePool_Impl> pImpl;
 
-protected:
     SfxStyleSheetIterator&      GetIterator_Impl(SfxStyleFamily eFamily, SfxStyleSearchBits eMask);
+protected:
+    SfxStyleSheetIterator*      GetCachedIterator();
 
     SfxItemPool&                rPool;
     SfxStyleFamily              nSearchFamily;
diff --git a/svl/source/items/style.cxx b/svl/source/items/style.cxx
index e6e1adf23cb9..ef1b7078b3f6 100644
--- a/svl/source/items/style.cxx
+++ b/svl/source/items/style.cxx
@@ -547,6 +547,11 @@ SfxStyleSearchBits SfxStyleSheetIterator::GetSearchMask() const
     return mask;
 }
 
+SfxStyleSheetIterator* SfxStyleSheetBasePool::GetCachedIterator()
+{
+    return pImpl->pIter.get();
+}
+
 SfxStyleSheetIterator& SfxStyleSheetBasePool::GetIterator_Impl(SfxStyleFamily eFamily, SfxStyleSearchBits eMask)
 {
     if (!pImpl->pIter || (pImpl->pIter->GetSearchMask() != eMask) || (pImpl->pIter->GetSearchFamily() != eFamily))
diff --git a/sw/source/uibase/app/docstyle.cxx b/sw/source/uibase/app/docstyle.cxx
index 3d3d2699491e..b2d431310daf 100644
--- a/sw/source/uibase/app/docstyle.cxx
+++ b/sw/source/uibase/app/docstyle.cxx
@@ -3189,7 +3189,8 @@ void SwStyleSheetIterator::AppendStyleList(const std::vector<OUString>& rList,
 
 void SwDocStyleSheetPool::InvalidateIterator()
 {
-    dynamic_cast<SwStyleSheetIterator&>(GetIterator_Impl(GetSearchFamily(), GetSearchMask())).InvalidateIterator();
+    if (SfxStyleSheetIterator* pIter = GetCachedIterator())
+        dynamic_cast<SwStyleSheetIterator&>(*pIter).InvalidateIterator();
 }
 
 void SwStyleSheetIterator::InvalidateIterator()


More information about the Libreoffice-commits mailing list