summaryrefslogtreecommitdiff
path: root/sw/source/core/doc/docfld.cxx
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-20 19:59:24 +0200
commit4a128f336a146a12c28bb9f3bdfa24d2198d85dc (patch)
treee529bb2be63cbee765a88d82a6899a7ec2377bb4 /sw/source/core/doc/docfld.cxx
parent3fdc41af6370a53f7db4e52104cfd3328ee40563 (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/40240 Reviewed-by: Michael Stahl <mstahl@redhat.com> Tested-by: Jenkins <ci@libreoffice.org>
Diffstat (limited to 'sw/source/core/doc/docfld.cxx')
-rw-r--r--sw/source/core/doc/docfld.cxx5
1 files changed, 4 insertions, 1 deletions
diff --git a/sw/source/core/doc/docfld.cxx b/sw/source/core/doc/docfld.cxx
index 00eb8b0466f6..d27d6c9fce19 100644
--- a/sw/source/core/doc/docfld.cxx
+++ b/sw/source/core/doc/docfld.cxx
@@ -1135,15 +1135,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 = std::move(pFnd->pNext);
+ // no need to explicitly delete here, the embedded linked list uses unique_ptr
}
- delete pFnd;
}
}
}