sw/inc/authfld.hxx | 1 + sw/source/core/fields/authfld.cxx | 14 +++++++++----- 2 files changed, 10 insertions(+), 5 deletions(-)
New commits: commit ef571f245ee7402380067e4ed2f8647c4b6cef95 Author: Noel Grandin <noel.gran...@collabora.co.uk> AuthorDate: Wed Dec 4 09:33:25 2019 +0200 Commit: Xisco FaulĂ <xiscofa...@libreoffice.org> CommitDate: Wed Dec 4 17:17: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.gran...@collabora.co.uk> (cherry picked from commit 41b752756e53c4f9c3d08cbce412d1408c5aed2f) Reviewed-on: https://gerrit.libreoffice.org/84413 Reviewed-by: Xisco FaulĂ <xiscofa...@libreoffice.org> 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" ); } _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits