[Libreoffice-commits] core.git: include/svx svx/source
Libreoffice Gerrit user
logerrit at kemper.freedesktop.org
Wed Aug 15 13:52:03 UTC 2018
include/svx/svdmodel.hxx | 2 +-
svx/source/inc/svdoutlinercache.hxx | 2 +-
svx/source/svdraw/svdmodel.cxx | 10 ++--------
svx/source/svdraw/svdoutlinercache.cxx | 9 ++++-----
svx/source/unodraw/unoshtxt.cxx | 9 ++++-----
5 files changed, 12 insertions(+), 20 deletions(-)
New commits:
commit 9d31badc81c5044269a50ee2bc16f757f258d617
Author: Noel Grandin <noel.grandin at collabora.co.uk>
AuthorDate: Sat Aug 11 10:36:07 2018 +0200
Commit: Noel Grandin <noel.grandin at collabora.co.uk>
CommitDate: Wed Aug 15 15:51:37 2018 +0200
loplugin:useuniqueptr in disposeOutliner
Change-Id: I038d98a4d4b3dd2a73afd8ddb4c4a7396e52267f
Reviewed-on: https://gerrit.libreoffice.org/59012
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>
diff --git a/include/svx/svdmodel.hxx b/include/svx/svdmodel.hxx
index 62bb9dd51533..cfe5ffdd6fb6 100644
--- a/include/svx/svdmodel.hxx
+++ b/include/svx/svdmodel.hxx
@@ -594,7 +594,7 @@ public:
void ReformatAllTextObjects();
std::unique_ptr<SdrOutliner> createOutliner( OutlinerMode nOutlinerMode );
- void disposeOutliner( SdrOutliner* pOutliner );
+ void disposeOutliner( std::unique_ptr<SdrOutliner> pOutliner );
bool IsWriter() const { return !bMyPool; }
diff --git a/svx/source/inc/svdoutlinercache.hxx b/svx/source/inc/svdoutlinercache.hxx
index 9eba3da602c9..a919da2ab89d 100644
--- a/svx/source/inc/svdoutlinercache.hxx
+++ b/svx/source/inc/svdoutlinercache.hxx
@@ -42,7 +42,7 @@ public:
~SdrOutlinerCache();
std::unique_ptr<SdrOutliner> createOutliner( OutlinerMode nOutlinerMode );
- void disposeOutliner( SdrOutliner* pOutliner );
+ void disposeOutliner( std::unique_ptr<SdrOutliner> pOutliner );
std::vector< SdrOutliner* > GetActiveOutliners() const;
};
diff --git a/svx/source/svdraw/svdmodel.cxx b/svx/source/svdraw/svdmodel.cxx
index 4889328cbf57..0677d4424593 100644
--- a/svx/source/svdraw/svdmodel.cxx
+++ b/svx/source/svdraw/svdmodel.cxx
@@ -1885,16 +1885,10 @@ std::vector<SdrOutliner*> SdrModel::GetActiveOutliners() const
return aRet;
}
-void SdrModel::disposeOutliner( SdrOutliner* pOutliner )
+void SdrModel::disposeOutliner( std::unique_ptr<SdrOutliner> pOutliner )
{
if( mpOutlinerCache )
- {
- mpOutlinerCache->disposeOutliner( pOutliner );
- }
- else
- {
- delete pOutliner;
- }
+ mpOutlinerCache->disposeOutliner( std::move(pOutliner) );
}
SvxNumType SdrModel::GetPageNumType() const
diff --git a/svx/source/svdraw/svdoutlinercache.cxx b/svx/source/svdraw/svdoutlinercache.cxx
index fe66e5f0a42f..1d9d75d81f08 100644
--- a/svx/source/svdraw/svdoutlinercache.cxx
+++ b/svx/source/svdraw/svdoutlinercache.cxx
@@ -59,7 +59,7 @@ SdrOutlinerCache::~SdrOutlinerCache()
{
}
-void SdrOutlinerCache::disposeOutliner( SdrOutliner* pOutliner )
+void SdrOutlinerCache::disposeOutliner( std::unique_ptr<SdrOutliner> pOutliner )
{
if( pOutliner )
{
@@ -67,26 +67,25 @@ void SdrOutlinerCache::disposeOutliner( SdrOutliner* pOutliner )
if( OutlinerMode::OutlineObject == nOutlMode )
{
- maModeOutline.emplace_back(pOutliner);
pOutliner->Clear();
pOutliner->SetVertical( false );
// Deregister on outliner, might be reused from outliner cache
pOutliner->SetNotifyHdl( Link<EENotify&,void>() );
+ maModeOutline.emplace_back(std::move(pOutliner));
}
else if( OutlinerMode::TextObject == nOutlMode )
{
- maModeText.emplace_back(pOutliner);
pOutliner->Clear();
pOutliner->SetVertical( false );
// Deregister on outliner, might be reused from outliner cache
pOutliner->SetNotifyHdl( Link<EENotify&,void>() );
+ maModeText.emplace_back(std::move(pOutliner));
}
else
{
- maActiveOutliners.erase(pOutliner);
- delete pOutliner;
+ maActiveOutliners.erase(pOutliner.get());
}
}
}
diff --git a/svx/source/unodraw/unoshtxt.cxx b/svx/source/unodraw/unoshtxt.cxx
index 466f564602e1..52414fb67957 100644
--- a/svx/source/unodraw/unoshtxt.cxx
+++ b/svx/source/unodraw/unoshtxt.cxx
@@ -85,7 +85,7 @@ private:
SdrView* mpView;
VclPtr<const vcl::Window> mpWindow;
SdrModel* mpModel; // TTTT probably not needed -> use SdrModel from SdrObject (?)
- SdrOutliner* mpOutliner;
+ std::unique_ptr<SdrOutliner> mpOutliner;
std::unique_ptr<SvxOutlinerForwarder> mpTextForwarder;
std::unique_ptr<SvxDrawOutlinerViewForwarder> mpViewForwarder; // if non-NULL, use GetViewModeTextForwarder text forwarder
css::uno::Reference< css::linguistic2::XLinguServiceManager2 > m_xLinguServiceManager;
@@ -406,13 +406,12 @@ void SvxTextEditSourceImpl::dispose()
{
if( mpModel )
{
- mpModel->disposeOutliner( mpOutliner );
+ mpModel->disposeOutliner( std::move(mpOutliner) );
}
else
{
- delete mpOutliner;
+ mpOutliner.reset();
}
- mpOutliner = nullptr;
}
if( mpModel )
@@ -500,7 +499,7 @@ SvxTextForwarder* SvxTextEditSourceImpl::GetBackgroundTextForwarder()
if( pTextObj && pTextObj->IsTextFrame() && pTextObj->GetTextKind() == OBJ_OUTLINETEXT )
nOutlMode = OutlinerMode::OutlineObject;
- mpOutliner = mpModel->createOutliner( nOutlMode ).release();
+ mpOutliner = mpModel->createOutliner( nOutlMode );
// Do the setup after outliner creation, would be useless otherwise
if( HasView() )
More information about the Libreoffice-commits
mailing list