[Libreoffice-commits] core.git: sc/source
Noel Grandin (via logerrit)
logerrit at kemper.freedesktop.org
Mon May 31 17:53:33 UTC 2021
sc/source/ui/Accessibility/AccessibleText.cxx | 22 ++++++++++------------
sc/source/ui/inc/AccessibleText.hxx | 4 ++--
2 files changed, 12 insertions(+), 14 deletions(-)
New commits:
commit 760933de5ab47f6313f93e28e31829e627b48b21
Author: Noel Grandin <noel.grandin at collabora.co.uk>
AuthorDate: Mon May 31 15:35:58 2021 +0200
Commit: Noel Grandin <noel.grandin at collabora.co.uk>
CommitDate: Mon May 31 19:52:48 2021 +0200
fix leak in JunitTest_sc_unoapi_2
Change-Id: I97d4be24c06dcb6c069380de357dcebe86dd176f
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/116450
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>
diff --git a/sc/source/ui/Accessibility/AccessibleText.cxx b/sc/source/ui/Accessibility/AccessibleText.cxx
index 54f8f15f49fc..13c67f73730b 100644
--- a/sc/source/ui/Accessibility/AccessibleText.cxx
+++ b/sc/source/ui/Accessibility/AccessibleText.cxx
@@ -1077,7 +1077,6 @@ ScDocShell* ScAccessiblePreviewHeaderCellTextData::GetDocShell(ScPreviewShell* p
ScAccessibleHeaderTextData::ScAccessibleHeaderTextData(ScPreviewShell* pViewShell,
const EditTextObject* pEditObj, SvxAdjust eAdjust)
:
- mpViewForwarder(nullptr),
mpViewShell(pViewShell),
mpDocSh(nullptr),
mpEditObj(pEditObj),
@@ -1113,8 +1112,8 @@ void ScAccessibleHeaderTextData::Notify( SfxBroadcaster&, const SfxHint& rHint )
{
mpViewShell = nullptr;// invalid now
mpDocSh = nullptr;
- if (mpViewForwarder)
- mpViewForwarder->SetInvalid();
+ if (mxViewForwarder)
+ mxViewForwarder->SetInvalid();
}
}
@@ -1176,15 +1175,14 @@ SvxTextForwarder* ScAccessibleHeaderTextData::GetTextForwarder()
SvxViewForwarder* ScAccessibleHeaderTextData::GetViewForwarder()
{
- if (!mpViewForwarder)
- mpViewForwarder = new ScPreviewHeaderFooterViewForwarder(mpViewShell);
- return mpViewForwarder;
+ if (!mxViewForwarder)
+ mxViewForwarder = std::make_unique<ScPreviewHeaderFooterViewForwarder>(mpViewShell);
+ return mxViewForwarder.get();
}
ScAccessibleNoteTextData::ScAccessibleNoteTextData(ScPreviewShell* pViewShell,
const OUString& sText, const ScAddress& aCellPos, bool bMarkNote)
:
- mpViewForwarder(nullptr),
mpViewShell(pViewShell),
mpDocSh(nullptr),
msText(sText),
@@ -1221,8 +1219,8 @@ void ScAccessibleNoteTextData::Notify( SfxBroadcaster&, const SfxHint& rHint )
{
mpViewShell = nullptr;// invalid now
mpDocSh = nullptr;
- if (mpViewForwarder)
- mpViewForwarder->SetInvalid();
+ if (mxViewForwarder)
+ mxViewForwarder->SetInvalid();
}
}
@@ -1279,9 +1277,9 @@ SvxTextForwarder* ScAccessibleNoteTextData::GetTextForwarder()
SvxViewForwarder* ScAccessibleNoteTextData::GetViewForwarder()
{
- if (!mpViewForwarder)
- mpViewForwarder = new ScPreviewNoteViewForwarder(mpViewShell);
- return mpViewForwarder;
+ if (!mxViewForwarder)
+ mxViewForwarder = std::make_unique<ScPreviewNoteViewForwarder>(mpViewShell);
+ return mxViewForwarder.get();
}
// CSV import =================================================================
diff --git a/sc/source/ui/inc/AccessibleText.hxx b/sc/source/ui/inc/AccessibleText.hxx
index 57a02475f0bb..23fdb3cb25ea 100644
--- a/sc/source/ui/inc/AccessibleText.hxx
+++ b/sc/source/ui/inc/AccessibleText.hxx
@@ -217,7 +217,7 @@ public:
virtual void UpdateData() override { }
private:
- ScPreviewViewForwarder* mpViewForwarder;
+ std::unique_ptr<ScPreviewViewForwarder> mxViewForwarder;
ScPreviewShell* mpViewShell;
std::unique_ptr<ScEditEngineDefaulter> mpEditEngine;
std::unique_ptr<SvxEditEngineForwarder> mpForwarder;
@@ -244,7 +244,7 @@ public:
virtual void UpdateData() override { }
private:
- ScPreviewViewForwarder* mpViewForwarder;
+ std::unique_ptr<ScPreviewViewForwarder> mxViewForwarder;
ScPreviewShell* mpViewShell;
std::unique_ptr<ScEditEngineDefaulter> mpEditEngine;
std::unique_ptr<SvxEditEngineForwarder> mpForwarder;
More information about the Libreoffice-commits
mailing list