summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarkus Mohrhard <markus.mohrhard@googlemail.com>2017-09-02 03:39:36 +0200
committerMarkus Mohrhard <markus.mohrhard@googlemail.com>2017-09-02 04:44:13 +0200
commitcb14008337e7b7ebbc0b5724f98ac9633e1b9331 (patch)
tree2776246950b5ad1a1cdb11d6bf7733cc2c4fc2ff
parentd58b2531d3f6d931dce5a6dfeef8926e20868f4d (diff)
make sure parent element is staying around
If we use a reference to the object we need to ensure that it not suddenly disappears on us. Change-Id: I7917fc696b0cc48dd26fa332c892f09727e40054 Reviewed-on: https://gerrit.libreoffice.org/41820 Reviewed-by: Markus Mohrhard <markus.mohrhard@googlemail.com> Tested-by: Jenkins <ci@libreoffice.org>
-rw-r--r--sc/inc/datauno.hxx2
-rw-r--r--sc/source/ui/unoobj/datauno.cxx14
2 files changed, 8 insertions, 8 deletions
diff --git a/sc/inc/datauno.hxx b/sc/inc/datauno.hxx
index 34b7da848779..26afe6030065 100644
--- a/sc/inc/datauno.hxx
+++ b/sc/inc/datauno.hxx
@@ -209,7 +209,7 @@ class ScSubTotalFieldObj : public cppu::WeakImplHelper<
css::lang::XServiceInfo >
{
private:
- ScSubTotalDescriptorBase& rParent;
+ rtl::Reference<ScSubTotalDescriptorBase> xParent;
sal_uInt16 nPos;
public:
diff --git a/sc/source/ui/unoobj/datauno.cxx b/sc/source/ui/unoobj/datauno.cxx
index 32ee2b1590bc..c2a280967ae3 100644
--- a/sc/source/ui/unoobj/datauno.cxx
+++ b/sc/source/ui/unoobj/datauno.cxx
@@ -447,7 +447,7 @@ void ScSortDescriptor::FillSortParam( ScSortParam& rParam, const uno::Sequence<b
}
ScSubTotalFieldObj::ScSubTotalFieldObj( ScSubTotalDescriptorBase* pDesc, sal_uInt16 nP ) :
- rParent( *pDesc ),
+ xParent( pDesc ),
nPos( nP )
{
OSL_ENSURE(pDesc, "ScSubTotalFieldObj: Parent is 0");
@@ -463,7 +463,7 @@ sal_Int32 SAL_CALL ScSubTotalFieldObj::getGroupColumn()
{
SolarMutexGuard aGuard;
ScSubTotalParam aParam;
- rParent.GetData(aParam);
+ xParent->GetData(aParam);
return aParam.nField[nPos];
}
@@ -472,18 +472,18 @@ void SAL_CALL ScSubTotalFieldObj::setGroupColumn( sal_Int32 nGroupColumn )
{
SolarMutexGuard aGuard;
ScSubTotalParam aParam;
- rParent.GetData(aParam);
+ xParent->GetData(aParam);
aParam.nField[nPos] = (SCCOL)nGroupColumn;
- rParent.PutData(aParam);
+ xParent->PutData(aParam);
}
uno::Sequence<sheet::SubTotalColumn> SAL_CALL ScSubTotalFieldObj::getSubTotalColumns()
{
SolarMutexGuard aGuard;
ScSubTotalParam aParam;
- rParent.GetData(aParam);
+ xParent->GetData(aParam);
SCCOL nCount = aParam.nSubTotals[nPos];
uno::Sequence<sheet::SubTotalColumn> aSeq(nCount);
@@ -502,7 +502,7 @@ void SAL_CALL ScSubTotalFieldObj::setSubTotalColumns(
{
SolarMutexGuard aGuard;
ScSubTotalParam aParam;
- rParent.GetData(aParam);
+ xParent->GetData(aParam);
sal_uInt32 nColCount = aSubTotalColumns.getLength();
if ( nColCount <= sal::static_int_cast<sal_uInt32>(SCCOL_MAX) )
@@ -529,7 +529,7 @@ void SAL_CALL ScSubTotalFieldObj::setSubTotalColumns(
}
//! otherwise exception or so? (too many columns)
- rParent.PutData(aParam);
+ xParent->PutData(aParam);
}
ScSubTotalDescriptorBase::ScSubTotalDescriptorBase() :