diff options
author | Miklos Vajna <vmiklos@collabora.com> | 2021-04-28 09:50:54 +0200 |
---|---|---|
committer | Miklos Vajna <vmiklos@collabora.com> | 2021-04-28 13:19:10 +0200 |
commit | b73c6c8e53cf944848cdb3a79371703de99a8710 (patch) | |
tree | 1ef6fc49454331df5f9cfe3f3449d1b42f0dc0d9 /sw/inc | |
parent | ecd8508eaf8a3eb064b26c5c80cd2930fe6e7555 (diff) |
sw bibliography: fix warning when de-selecting a biblio entry field
De-selecting a biblio entry field resulted in this warning:
warn:sw.core:3311:3311:sw/source/core/fields/authfld.cxx:104: SwAuthorityFieldType::RemoveField: pEntry is not my field
But this was even an assert before commit
64ffabbdb2725e93de997171708bb31c33c93a55 (sw bibliography, refer to a
page: make the biblio field clickable, 2021-03-12).
It seems the root of the problem was:
- SwAuthorityFieldType has a list of SwAuthEntry instances that its
SwAuthorityFields may have
- when the field is selected, we copy the selection to a clipboard
document, using SwFEShell::Copy()
- this calls SwAuthorityFieldType::AppendField() to register the
SwAuthEntry, but that registers a copy instead
- SwAuthorityFieldType::RemoveField() then asserted that the original
SwAuthEntry is part of SwAuthorityFieldType's list, but it was not
Fix the problem by returning a reference to the copied SwAuthEntry in
SwAuthorityFieldType::AppendField(), that fixes the warning and then we
can turn this back to an assert, to detect problems where an
unregistered SwAuthEntry would be de-registered.
In practice this caused a problem in the Insert Bibliography Entry
dialog: bibliography source = document content case uses
SwAuthorityFieldType::GetAllEntryIdentifiers() to provide a list of
sources, and this way sources were not removed from that list when
deleting biblio entry fields.
Change-Id: Iea4fa44302aaac0daa122bbf227888d1dbb06597
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/114765
Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
Tested-by: Jenkins
Diffstat (limited to 'sw/inc')
-rw-r--r-- | sw/inc/authfld.hxx | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/sw/inc/authfld.hxx b/sw/inc/authfld.hxx index 681f95eddc31..fcf4f128361d 100644 --- a/sw/inc/authfld.hxx +++ b/sw/inc/authfld.hxx @@ -99,7 +99,7 @@ public: bool ChangeEntryContent(const SwAuthEntry* pNewEntry); // import interface - sal_uInt16 AppendField(const SwAuthEntry& rInsert); + SwAuthEntry* AppendField(const SwAuthEntry& rInsert); sal_uInt16 GetSequencePos(const SwAuthEntry* pAuthEntry, SwRootFrame const* pLayout); std::unique_ptr<SwTOXInternational> CreateTOXInternational() const; @@ -139,6 +139,7 @@ public: const OUString& GetSortAlgorithm() const {return m_sSortAlgorithm;} void SetSortAlgorithm(const OUString& rSet) {m_sSortAlgorithm = rSet;} + void dumpAsXml(xmlTextWriterPtr pWriter) const override; }; |