fix ScJumpMatrixToken memory handling

ScJumpMatrixToken unconditionally deletes the ScJumpMatrix pointer it
receives. But it's copy constructor also just copies that pointer,
meaning that we could end up freeing that pointer twice.

ScJumpMatrix has no copy constructor, so I just managed it via
shared_ptr.

Change-Id: I9cf13312afb4f2869fdc878e5f34060614e31842
Reviewed-on: https://gerrit.libreoffice.org/41728
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Tested-by: Noel Grandin <noel.grandin@collabora.co.uk>
This commit is contained in:
Noel Grandin
2017-08-30 12:46:38 +02:00
parent 4e825d97a8
commit 80dd56035e
5 changed files with 26 additions and 21 deletions

View File

@@ -127,15 +127,9 @@ void UseUniquePtr::CheckForSingleUnconditionalDelete(const CXXDestructorDecl* de
// something platform-specific
if (loplugin::hasPathnamePrefix(aFileName, SRCDIR "/hwpfilter/source/htags.h"))
return;
// @TODO there is clearly a bug in the ownership here, the operator= method cannot be right
if (loplugin::hasPathnamePrefix(aFileName, SRCDIR "/include/formula/formdata.hxx"))
return;
// passes pointers to member fields
if (loplugin::hasPathnamePrefix(aFileName, SRCDIR "/sd/inc/sdpptwrp.hxx"))
return;
// @TODO there is clearly a bug in the ownership here, the ScJumpMatrixToken copy constructor cannot be right
if (loplugin::hasPathnamePrefix(aFileName, SRCDIR "/sc/inc/token.hxx"))
return;
// @TODO intrusive linked-lists here, with some trickiness
if (loplugin::hasPathnamePrefix(aFileName, SRCDIR "/sw/source/filter/html/parcss1.hxx"))
return;