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

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


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

New commits:
commit b2149b8b43f6c5c8aaf085e1fd1d179353d7298b
Author:     Noel Grandin <noel.grandin at collabora.co.uk>
AuthorDate: Wed Dec 4 09:33:25 2019 +0200
Commit:     Thorsten Behrens <Thorsten.Behrens at CIB.de>
CommitDate: Wed Dec 4 18:50:31 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/84413
    Reviewed-by: Xisco Faulí <xiscofauli at libreoffice.org>
    (cherry picked from commit ef571f245ee7402380067e4ed2f8647c4b6cef95)
    Reviewed-on: https://gerrit.libreoffice.org/84427
    Reviewed-by: Christian Lohmaier <lohmaier+LibreOffice at googlemail.com>
    Reviewed-by: Thorsten Behrens <Thorsten.Behrens at CIB.de>
    Tested-by: Thorsten Behrens <Thorsten.Behrens at CIB.de>

diff --git a/sw/inc/authfld.hxx b/sw/inc/authfld.hxx
index 9a9ba06c13c1..389ae530c3b0 100644
--- a/sw/inc/authfld.hxx
+++ b/sw/inc/authfld.hxx
@@ -31,6 +31,7 @@
 
 class SwAuthEntry : 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 c84b44d0a7d1..cb204c6f246f 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