summaryrefslogtreecommitdiff
path: root/sc/source/ui/unoobj
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2018-08-24 13:31:37 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2018-08-24 15:56:56 +0200
commitb5ee452d403b0c94cc0d7548117e9c96d1d45c67 (patch)
tree3dee60a4d614769d2034c8256a4ffeab31ae3182 /sc/source/ui/unoobj
parent16357f1c65189c9ae66763356d935c3516baa355 (diff)
loplugin:useuniqueptr in ScEditFieldObj
consequently fixing potential leak in InitDoc Change-Id: I50885f32d2465b41ede5dcf6653d7d8d30a3aeba Reviewed-on: https://gerrit.libreoffice.org/59557 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'sc/source/ui/unoobj')
-rw-r--r--sc/source/ui/unoobj/cellsuno.cxx2
-rw-r--r--sc/source/ui/unoobj/fielduno.cxx12
-rw-r--r--sc/source/ui/unoobj/servuno.cxx1
-rw-r--r--sc/source/ui/unoobj/textuno.cxx2
4 files changed, 9 insertions, 8 deletions
diff --git a/sc/source/ui/unoobj/cellsuno.cxx b/sc/source/ui/unoobj/cellsuno.cxx
index 1d951628466c..8346be3d8c88 100644
--- a/sc/source/ui/unoobj/cellsuno.cxx
+++ b/sc/source/ui/unoobj/cellsuno.cxx
@@ -6250,7 +6250,7 @@ void SAL_CALL ScCellObj::insertTextContent( const uno::Reference<text::XTextRang
aSelection.nEndPos = aSelection.nStartPos + 1;
uno::Reference<text::XTextRange> xParent(this);
pCellField->InitDoc(
- xParent, new ScCellEditSource(pDocSh, aCellPos), aSelection);
+ xParent, o3tl::make_unique<ScCellEditSource>(pDocSh, aCellPos), aSelection);
// for bAbsorb=FALSE, the new selection must be behind the inserted content
// (the xml filter relies on this)
diff --git a/sc/source/ui/unoobj/fielduno.cxx b/sc/source/ui/unoobj/fielduno.cxx
index c75f351b9641..f6d33ce284aa 100644
--- a/sc/source/ui/unoobj/fielduno.cxx
+++ b/sc/source/ui/unoobj/fielduno.cxx
@@ -336,7 +336,7 @@ uno::Reference<text::XTextField> ScCellFieldsObj::GetObjectByIndex_Impl(sal_Int3
sal_Int32 eType = pData->GetClassId();
uno::Reference<text::XTextField> xRet(
- new ScEditFieldObj(mxContent, new ScCellEditSource(pDocShell, aCellPos), eType, aSelection));
+ new ScEditFieldObj(mxContent, o3tl::make_unique<ScCellEditSource>(pDocShell, aCellPos), eType, aSelection));
return xRet;
}
@@ -493,7 +493,7 @@ uno::Reference<text::XTextField> ScHeaderFieldsObj::GetObjectByIndex_Impl(sal_In
sal_Int32 eRealType = pData->GetClassId();
uno::Reference<text::XTextField> xRet(
- new ScEditFieldObj(xTextRange, new ScHeaderFooterEditSource(mrData), eRealType, aSelection));
+ new ScEditFieldObj(xTextRange, o3tl::make_unique<ScHeaderFooterEditSource>(mrData), eRealType, aSelection));
return xRet;
}
@@ -1061,10 +1061,10 @@ void ScEditFieldObj::setPropertyValueSheet(const OUString& rName, const uno::Any
ScEditFieldObj::ScEditFieldObj(
const uno::Reference<text::XTextRange>& rContent,
- ScEditSource* pEditSrc, sal_Int32 eType, const ESelection& rSel) :
+ std::unique_ptr<ScEditSource> pEditSrc, sal_Int32 eType, const ESelection& rSel) :
OComponentHelper(getMutex()),
pPropSet(nullptr),
- mpEditSource(pEditSrc),
+ mpEditSource(std::move(pEditSrc)),
aSelection(rSel),
meType(eType), mpData(nullptr), mpContent(rContent), mnNumFormat(0), mbIsDate(false), mbIsFixed(false)
{
@@ -1093,7 +1093,7 @@ ScEditFieldObj::ScEditFieldObj(
}
void ScEditFieldObj::InitDoc(
- const uno::Reference<text::XTextRange>& rContent, ScEditSource* pEditSrc, const ESelection& rSel)
+ const uno::Reference<text::XTextRange>& rContent, std::unique_ptr<ScEditSource> pEditSrc, const ESelection& rSel)
{
if (!mpEditSource)
{
@@ -1101,7 +1101,7 @@ void ScEditFieldObj::InitDoc(
mpData.reset();
aSelection = rSel;
- mpEditSource.reset( pEditSrc );
+ mpEditSource = std::move( pEditSrc );
}
}
diff --git a/sc/source/ui/unoobj/servuno.cxx b/sc/source/ui/unoobj/servuno.cxx
index 37186b02be7c..9bcc3e593298 100644
--- a/sc/source/ui/unoobj/servuno.cxx
+++ b/sc/source/ui/unoobj/servuno.cxx
@@ -28,6 +28,7 @@
#include <com/sun/star/container/XNameAccess.hpp>
#include <com/sun/star/text/textfield/Type.hpp>
+#include <editsrc.hxx>
#include <servuno.hxx>
#include <unonames.hxx>
#include <appluno.hxx>
diff --git a/sc/source/ui/unoobj/textuno.cxx b/sc/source/ui/unoobj/textuno.cxx
index eedb082d83ab..726ed85c508e 100644
--- a/sc/source/ui/unoobj/textuno.cxx
+++ b/sc/source/ui/unoobj/textuno.cxx
@@ -447,7 +447,7 @@ void SAL_CALL ScHeaderFooterTextObj::insertTextContent(
break;
}
- pHeaderField->InitDoc(xTextRange, new ScHeaderFooterEditSource(aTextData), aSelection);
+ pHeaderField->InitDoc(xTextRange, o3tl::make_unique<ScHeaderFooterEditSource>(aTextData), aSelection);
// for bAbsorb=FALSE, the new selection must be behind the inserted content
// (the xml filter relies on this)