summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2017-07-20 17:10:50 +0200
committerMichael Meeks <michael.meeks@collabora.com>2017-07-21 11:57:10 +0200
commit53cb76a7f66c594f210f539ec3a80c45a2ca4fd7 (patch)
tree1ced0f1fcec0050ae311efc7f2cf8b33657c0afe
parent5fb6e24496a925eafe91b337ab4e8ae6a4ed8900 (diff)
tdf#109197 crash when deleting user field variables in sw
regression from: commit a706bb06d5326e7a997dd1d71f3f947bd0ad28e6 "new loplugin: useuniqueptr: sw part 1" Change-Id: I57f9c9e6d7eeccc033b71d7182c960f3d79df73c Reviewed-on: https://gerrit.libreoffice.org/40244 Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk> Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Michael Meeks <michael.meeks@collabora.com> (cherry picked from commit 8f232771e84ba0369acb27085813d5810b15724b) Reviewed-on: https://gerrit.libreoffice.org/40247 Reviewed-by: Michael Stahl <mstahl@redhat.com> Reviewed-by: Xisco FaulĂ­ <xiscofauli@libreoffice.org> Tested-by: Michael Meeks <michael.meeks@collabora.com>
-rw-r--r--sw/source/core/doc/docfld.cxx7
1 files changed, 5 insertions, 2 deletions
diff --git a/sw/source/core/doc/docfld.cxx b/sw/source/core/doc/docfld.cxx
index c30341c23394..563c525685f6 100644
--- a/sw/source/core/doc/docfld.cxx
+++ b/sw/source/core/doc/docfld.cxx
@@ -1138,15 +1138,18 @@ void SwDocUpdateField::RemoveFieldType( const SwFieldType& rType )
if( pFnd )
{
if( aFieldTypeTable[ n ] == pFnd )
+ {
aFieldTypeTable[ n ] = static_cast<SwCalcFieldType*>(pFnd->pNext.release());
+ delete pFnd;
+ }
else
{
SwHash* pPrev = aFieldTypeTable[ n ];
while( pPrev->pNext.get() != pFnd )
pPrev = pPrev->pNext.get();
- pPrev->pNext.reset( pFnd->pNext.release() );
+ pPrev->pNext = std::move(pFnd->pNext);
+ // no need to explicitly delete here, the embedded linked list uses unique_ptr
}
- delete pFnd;
}
}
}