[Libreoffice-commits] core.git: Branch 'libreoffice-6-4' - sw/inc sw/source

Noel Grandin (via logerrit) logerrit at kemper.freedesktop.org
Wed Dec 4 17:39:42 UTC 2019


 sw/inc/authfld.hxx                |    1 +
 sw/source/core/fields/authfld.cxx |   14 +++++++++-----
 2 files changed, 10 insertions(+), 5 deletions(-)

New commits:
commit 708688556cf820d8fda2e9bc7a6b7d098b76738a
Author:     Noel Grandin <noel.grandin at collabora.co.uk>
AuthorDate: Wed Dec 4 09:33:25 2019 +0200
Commit:     Xisco Faulí <xiscofauli at libreoffice.org>
CommitDate: Wed Dec 4 18:38:50 2019 +0100

    tdf#128845 writer, cannot modify a bibliography entry
    
    regression from
        commit 3b16e997f69efe2e3f6cdf64fe8fb2727b6ebaa7
        Date:   Fri Jan 18 15:38:07 2019 +0200
        cleanup SwAuthEntry manual ref-counting
    
    Change-Id: I30bd7af3cea51cedf5ca9bc43171665fb71830aa
    Reviewed-on: https://gerrit.libreoffice.org/84388
    Tested-by: Jenkins
    Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>
    (cherry picked from commit 41b752756e53c4f9c3d08cbce412d1408c5aed2f)
    Reviewed-on: https://gerrit.libreoffice.org/84411
    Reviewed-by: Xisco Faulí <xiscofauli at libreoffice.org>

diff --git a/sw/inc/authfld.hxx b/sw/inc/authfld.hxx
index fe631d7715a0..356eddd86c39 100644
--- a/sw/inc/authfld.hxx
+++ b/sw/inc/authfld.hxx
@@ -31,6 +31,7 @@
 
 class SwAuthEntry final : public salhelper::SimpleReferenceObject
 {
+friend class SwAuthorityFieldType;
     OUString        aAuthFields[AUTH_FIELD_END];
 public:
     SwAuthEntry() = default;
diff --git a/sw/source/core/fields/authfld.cxx b/sw/source/core/fields/authfld.cxx
index 06e9ccabceba..1e85e1780b97 100644
--- a/sw/source/core/fields/authfld.cxx
+++ b/sw/source/core/fields/authfld.cxx
@@ -86,18 +86,22 @@ std::unique_ptr<SwFieldType> SwAuthorityFieldType::Copy()  const
     return std::make_unique<SwAuthorityFieldType>(m_pDoc);
 }
 
-void SwAuthorityFieldType::RemoveField(const SwAuthEntry* nHandle)
+void SwAuthorityFieldType::RemoveField(const SwAuthEntry* pEntry)
 {
     for(SwAuthDataArr::size_type j = 0; j < m_DataArr.size(); ++j)
     {
-        if(m_DataArr[j].get() == nHandle)
+        if(m_DataArr[j].get() == pEntry)
         {
-            m_DataArr.erase(m_DataArr.begin() + j);
-            //re-generate positions of the fields
-            DelSequenceArray();
+            if (m_DataArr[j]->m_nCount <= 1)
+            {
+                m_DataArr.erase(m_DataArr.begin() + j);
+                //re-generate positions of the fields
+                DelSequenceArray();
+            }
             return;
         }
     }
+    assert(false);
     OSL_FAIL("Field unknown" );
 }
 


More information about the Libreoffice-commits mailing list