summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJulien Nabet <serval2412@yahoo.fr>2019-10-18 23:56:52 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2019-10-19 08:04:44 +0200
commit09a3762fe0fc4c4815c842098094082bf1b90de6 (patch)
tree88cdbfa62017f19f194dd3c638851b02d5a2fd07
parent74f938bb10b6db8cae071efc9fd29015befeb5e6 (diff)
tdf#128232: fix crash when trying to delete unused User Field
mpFieldTypes is std::unique_ptr<SwFieldTypes> (see https://opengrok.libreoffice.org/xref/core/sw/source/core/inc/DocumentFieldsManager.hxx?r=99a97d38#104) See bt: https://bugs.documentfoundation.org/attachment.cgi?id=155132 Change-Id: Iea8eddd4b1bdc9ce3c01988fc97004b7ec7a6e5f Reviewed-on: https://gerrit.libreoffice.org/81114 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
-rw-r--r--sw/source/core/doc/DocumentFieldsManager.cxx3
1 files changed, 1 insertions, 2 deletions
diff --git a/sw/source/core/doc/DocumentFieldsManager.cxx b/sw/source/core/doc/DocumentFieldsManager.cxx
index 9d391b47fb83..2d64955bb1f8 100644
--- a/sw/source/core/doc/DocumentFieldsManager.cxx
+++ b/sw/source/core/doc/DocumentFieldsManager.cxx
@@ -374,11 +374,10 @@ void DocumentFieldsManager::RemoveFieldType(size_t nField)
if( nWhich != SwFieldIds::Database )
{
OSL_ENSURE( !pTmp->HasWriterListeners(), "Dependent fields present!" );
- // delete field type
- delete pTmp;
}
else
(*mpFieldTypes)[nField].release(); // DB fields are ref-counted and delete themselves
+
mpFieldTypes->erase( mpFieldTypes->begin() + nField );
m_rDoc.getIDocumentState().SetModified();
}