summaryrefslogtreecommitdiffstats
path: root/sc/inc
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2017-08-30 12:46:38 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2017-08-30 13:23:15 +0200
commit80dd56035e91666efa551c1e4dd4341d30c06510 (patch)
tree89c90cbd761bd6e22d7bfe2a391cf8aea76cb0d4 /sc/inc
parentgpg4libre: Encrypt with GPG checkbox in SaveAs file dialog, 1st stab (diff)
downloadcore-80dd56035e91666efa551c1e4dd4341d30c06510.tar.gz
core-80dd56035e91666efa551c1e4dd4341d30c06510.zip
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>
Diffstat (limited to 'sc/inc')
-rw-r--r--sc/inc/token.hxx9
1 files changed, 4 insertions, 5 deletions
diff --git a/sc/inc/token.hxx b/sc/inc/token.hxx
index 7e20b691d96b..9019ebf0ed89 100644
--- a/sc/inc/token.hxx
+++ b/sc/inc/token.hxx
@@ -20,6 +20,7 @@
#ifndef INCLUDED_SC_INC_TOKEN_HXX
#define INCLUDED_SC_INC_TOKEN_HXX
+#include <memory>
#include <vector>
#include <boost/intrusive_ptr.hpp>
@@ -247,12 +248,10 @@ private:
class ScJumpMatrixToken : public formula::FormulaToken
{
private:
- ScJumpMatrix* pJumpMatrix;
+ std::shared_ptr<ScJumpMatrix> mpJumpMatrix;
public:
- ScJumpMatrixToken( ScJumpMatrix* p ) :
- FormulaToken( formula::svJumpMatrix ), pJumpMatrix( p ) {}
- ScJumpMatrixToken( const ScJumpMatrixToken& r ) :
- FormulaToken( r ), pJumpMatrix( r.pJumpMatrix ) {}
+ ScJumpMatrixToken( std::shared_ptr<ScJumpMatrix> p );
+ ScJumpMatrixToken( const ScJumpMatrixToken & p );
virtual ~ScJumpMatrixToken() override;
virtual ScJumpMatrix* GetJumpMatrix() const override;
virtual bool operator==( const formula::FormulaToken& rToken ) const override;