summaryrefslogtreecommitdiff
path: root/sc
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2020-08-12 10:29:35 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2020-08-12 14:25:16 +0200
commit05bf4b0a3af2e55501f8ce73cc97ca5e2caa54c2 (patch)
tree6e2ccc4a0d00965c99e17e5253c301fcf69ec51a /sc
parent537693e57281f1129ae837a569d88ceff44425b0 (diff)
fix leak in ScAccessiblePreviewHeaderCell
Change-Id: I0bafbe6d60980146006825229c0476fc22d1510f Reviewed-on: https://gerrit.libreoffice.org/c/core/+/100585 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'sc')
-rw-r--r--sc/source/ui/Accessibility/AccessiblePreviewHeaderCell.cxx25
-rw-r--r--sc/source/ui/inc/AccessiblePreviewHeaderCell.hxx2
2 files changed, 13 insertions, 14 deletions
diff --git a/sc/source/ui/Accessibility/AccessiblePreviewHeaderCell.cxx b/sc/source/ui/Accessibility/AccessiblePreviewHeaderCell.cxx
index 380b173d9845..ea6997331638 100644
--- a/sc/source/ui/Accessibility/AccessiblePreviewHeaderCell.cxx
+++ b/sc/source/ui/Accessibility/AccessiblePreviewHeaderCell.cxx
@@ -57,7 +57,6 @@ ScAccessiblePreviewHeaderCell::ScAccessiblePreviewHeaderCell( const css::uno::Re
sal_Int32 nIndex ) :
ScAccessibleContextBase( rxParent, AccessibleRole::TABLE_CELL ),
mpViewShell( pViewShell ),
- mpTextHelper( nullptr ),
mnIndex( nIndex ),
maCellPos( rCellPos ),
mbColumnHeader( bIsColHdr ),
@@ -94,8 +93,8 @@ void ScAccessiblePreviewHeaderCell::Notify( SfxBroadcaster& rBC, const SfxHint&
const SfxHintId nId = rHint.GetId();
if (nId == SfxHintId::ScAccVisAreaChanged)
{
- if (mpTextHelper)
- mpTextHelper->UpdateChildren();
+ if (mxTextHelper)
+ mxTextHelper->UpdateChildren();
}
else if ( nId == SfxHintId::DataChanged )
{
@@ -178,10 +177,10 @@ uno::Reference< XAccessible > SAL_CALL ScAccessiblePreviewHeaderCell::getAccessi
SolarMutexGuard aGuard;
IsObjectValid();
- if(!mpTextHelper)
+ if(!mxTextHelper)
CreateTextHelper();
- xRet = mpTextHelper->GetAt(rPoint);
+ xRet = mxTextHelper->GetAt(rPoint);
}
return xRet;
@@ -205,18 +204,18 @@ sal_Int32 SAL_CALL ScAccessiblePreviewHeaderCell::getAccessibleChildCount()
{
SolarMutexGuard aGuard;
IsObjectValid();
- if (!mpTextHelper)
+ if (!mxTextHelper)
CreateTextHelper();
- return mpTextHelper->GetChildCount();
+ return mxTextHelper->GetChildCount();
}
uno::Reference< XAccessible > SAL_CALL ScAccessiblePreviewHeaderCell::getAccessibleChild(sal_Int32 nIndex)
{
SolarMutexGuard aGuard;
IsObjectValid();
- if (!mpTextHelper)
+ if (!mxTextHelper)
CreateTextHelper();
- return mpTextHelper->GetChild(nIndex);
+ return mxTextHelper->GetChild(nIndex);
}
sal_Int32 SAL_CALL ScAccessiblePreviewHeaderCell::getAccessibleIndexInParent()
@@ -377,14 +376,14 @@ bool ScAccessiblePreviewHeaderCell::IsDefunc( const uno::Reference<XAccessibleSt
void ScAccessiblePreviewHeaderCell::CreateTextHelper()
{
- if (!mpTextHelper)
+ if (!mxTextHelper)
{
- mpTextHelper = new ::accessibility::AccessibleTextHelper(
+ mxTextHelper.reset( new ::accessibility::AccessibleTextHelper(
std::make_unique<ScAccessibilityEditSource>(
std::make_unique<ScAccessiblePreviewHeaderCellTextData>(
mpViewShell, getAccessibleName(), maCellPos,
- mbColumnHeader, mbRowHeader)));
- mpTextHelper->SetEventSource(this);
+ mbColumnHeader, mbRowHeader))) );
+ mxTextHelper->SetEventSource(this);
}
}
diff --git a/sc/source/ui/inc/AccessiblePreviewHeaderCell.hxx b/sc/source/ui/inc/AccessiblePreviewHeaderCell.hxx
index 7af796fb6563..e18c7eb54a6b 100644
--- a/sc/source/ui/inc/AccessiblePreviewHeaderCell.hxx
+++ b/sc/source/ui/inc/AccessiblePreviewHeaderCell.hxx
@@ -113,7 +113,7 @@ protected:
private:
ScPreviewShell* mpViewShell;
- accessibility::AccessibleTextHelper* mpTextHelper;
+ std::unique_ptr<accessibility::AccessibleTextHelper> mxTextHelper;
sal_Int32 mnIndex;
ScAddress maCellPos;
bool mbColumnHeader;