summaryrefslogtreecommitdiff
path: root/sc/inc/tokenarray.hxx
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2019-12-13 15:59:51 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2019-12-13 19:41:59 +0100
commit113444f59dc7690850919155b9b164b1a686bbe7 (patch)
tree90828ec324aabf60236f0785178c60144c2b4975 /sc/inc/tokenarray.hxx
parent3b8e554b69de349a20d10ec90b27ab71a013b464 (diff)
sc: rowcol: tdf#50916 create ScSheetLimits to hold by rtl::Reference
ScTokenArray sometimes outlives the ScDocument that created it, which means it accesses dead data when it tries to validate columns and rows. So create the ScSheetLimits class, which ScTokenArray can hold by reference counted pointer. Change-Id: Ic5771734fe4962d12f024fc1b29232124c14208a Reviewed-on: https://gerrit.libreoffice.org/85117 Tested-by: Jenkins Reviewed-by: Michael Meeks <michael.meeks@collabora.com>
Diffstat (limited to 'sc/inc/tokenarray.hxx')
-rw-r--r--sc/inc/tokenarray.hxx8
1 files changed, 6 insertions, 2 deletions
diff --git a/sc/inc/tokenarray.hxx b/sc/inc/tokenarray.hxx
index ae6eb22a593f..37ccf6b67c06 100644
--- a/sc/inc/tokenarray.hxx
+++ b/sc/inc/tokenarray.hxx
@@ -21,6 +21,7 @@
#define INCLUDED_SC_INC_TOKENARRAY_HXX
#include <formula/token.hxx>
+#include <rtl/ref.hxx>
#include "scdllapi.h"
#include "types.hxx"
#include "calcmacros.hxx"
@@ -43,14 +44,16 @@ class ColRowReorderMapType;
struct ScRawToken;
struct ScSingleRefData;
struct ScComplexRefData;
+struct ScSheetLimits;
class SAL_WARN_UNUSED SC_DLLPUBLIC ScTokenArray final : public formula::FormulaTokenArray
{
friend class ScCompiler;
- bool ImplGetReference( const ScDocument* pDoc, ScRange& rRange, const ScAddress& rPos, bool bValidOnly ) const;
+ bool ImplGetReference( ScRange& rRange, const ScAddress& rPos, bool bValidOnly ) const;
- const ScDocument* mpDoc;
+ // hold a reference to the limits because sometimes our lifetime exceeds the lifetime of the associated ScDocument
+ rtl::Reference<ScSheetLimits> mxSheetLimits;
size_t mnHashValue;
ScFormulaVectorState meVectorState : 4; // Only 4 bits
bool mbOpenCLEnabled : 1;
@@ -60,6 +63,7 @@ class SAL_WARN_UNUSED SC_DLLPUBLIC ScTokenArray final : public formula::FormulaT
public:
ScTokenArray(const ScDocument* pDoc);
+ ScTokenArray(ScSheetLimits&);
/** Assignment with incrementing references of FormulaToken entries
(not copied!) */
ScTokenArray( const ScTokenArray& ) = default;