summaryrefslogtreecommitdiff
path: root/sfx2/source/appl
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2017-01-17 10:13:14 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2017-01-17 10:48:27 +0000
commit49bfc59272f8482ca37abc631d2c3777518fd1d5 (patch)
treee01cb4a3fa03b6dbd7107e409de83de19813d804 /sfx2/source/appl
parent88c755e37cd36ddfe6d0d651540d9f2bd8a029a6 (diff)
new loplugin: useuniqueptr: sfx2
Change-Id: I544c615105d14fa258fed7f30790d305e987f523 Reviewed-on: https://gerrit.libreoffice.org/33206 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'sfx2/source/appl')
-rw-r--r--sfx2/source/appl/appcfg.cxx13
-rw-r--r--sfx2/source/appl/appchild.cxx2
-rw-r--r--sfx2/source/appl/childwin.cxx1
-rw-r--r--sfx2/source/appl/linksrc.cxx40
-rw-r--r--sfx2/source/appl/lnkbase2.cxx11
5 files changed, 23 insertions, 44 deletions
diff --git a/sfx2/source/appl/appcfg.cxx b/sfx2/source/appl/appcfg.cxx
index a4303961c8b2..b7e89dcd2de5 100644
--- a/sfx2/source/appl/appcfg.cxx
+++ b/sfx2/source/appl/appcfg.cxx
@@ -81,14 +81,13 @@ using namespace ::com::sun::star::beans;
class SfxEventAsyncer_Impl : public SfxListener
{
- SfxEventHint aHint;
- Idle* pIdle;
+ SfxEventHint aHint;
+ std::unique_ptr<Idle> pIdle;
public:
virtual void Notify( SfxBroadcaster& rBC, const SfxHint& rHint ) override;
explicit SfxEventAsyncer_Impl(const SfxEventHint& rHint);
- virtual ~SfxEventAsyncer_Impl() override;
DECL_LINK( IdleHdl, Idle*, void );
};
@@ -108,19 +107,13 @@ SfxEventAsyncer_Impl::SfxEventAsyncer_Impl( const SfxEventHint& rHint )
{
if( rHint.GetObjShell() )
StartListening( *rHint.GetObjShell() );
- pIdle = new Idle("SfxEventASyncer");
+ pIdle.reset( new Idle("SfxEventASyncer") );
pIdle->SetIdleHdl( LINK(this, SfxEventAsyncer_Impl, IdleHdl) );
pIdle->SetPriority( SchedulerPriority::HIGHEST );
pIdle->Start();
}
-SfxEventAsyncer_Impl::~SfxEventAsyncer_Impl()
-{
- delete pIdle;
-}
-
-
IMPL_LINK(SfxEventAsyncer_Impl, IdleHdl, Idle*, pAsyncIdle, void)
{
SfxObjectShellRef xRef( aHint.GetObjShell() );
diff --git a/sfx2/source/appl/appchild.cxx b/sfx2/source/appl/appchild.cxx
index 2669ab991bae..1c36be3c1b77 100644
--- a/sfx2/source/appl/appchild.cxx
+++ b/sfx2/source/appl/appchild.cxx
@@ -115,7 +115,7 @@ void SfxApplication::RegisterChildWindowContext_Impl( SfxModule *pMod, sal_uInt1
if ( pF )
{
if ( !pF->pArr )
- pF->pArr = new SfxChildWinContextArr_Impl;
+ pF->pArr.reset( new SfxChildWinContextArr_Impl );
pF->pArr->push_back( pFact );
return;
}
diff --git a/sfx2/source/appl/childwin.cxx b/sfx2/source/appl/childwin.cxx
index a637818b227a..54a581cad7c8 100644
--- a/sfx2/source/appl/childwin.cxx
+++ b/sfx2/source/appl/childwin.cxx
@@ -51,7 +51,6 @@ SfxChildWinFactory::SfxChildWinFactory( SfxChildWinCtor pTheCtor, sal_uInt16 nID
SfxChildWinFactory::~SfxChildWinFactory()
{
- delete pArr;
}
struct SfxChildWindow_Impl
diff --git a/sfx2/source/appl/linksrc.cxx b/sfx2/source/appl/linksrc.cxx
index d146fe92c7d5..e7c5a38f97e9 100644
--- a/sfx2/source/appl/linksrc.cxx
+++ b/sfx2/source/appl/linksrc.cxx
@@ -53,14 +53,14 @@ void SvLinkSourceTimer::Invoke()
pOwner->SendDataChanged();
}
-static void StartTimer( SvLinkSourceTimer ** ppTimer, SvLinkSource * pOwner,
+static void StartTimer( std::unique_ptr<SvLinkSourceTimer>& pTimer, SvLinkSource * pOwner,
sal_uIntPtr nTimeout )
{
- if( !*ppTimer )
+ if( !pTimer )
{
- *ppTimer = new SvLinkSourceTimer( pOwner );
- (*ppTimer)->SetTimeout( nTimeout );
- (*ppTimer)->Start();
+ pTimer.reset( new SvLinkSourceTimer( pOwner ) );
+ pTimer->SetTimeout( nTimeout );
+ pTimer->Start();
}
}
@@ -182,11 +182,12 @@ struct SvLinkSource_Impl
{
SvLinkSource_Array_Impl aArr;
OUString aDataMimeType;
- SvLinkSourceTimer * pTimer;
+ std::unique_ptr<SvLinkSourceTimer>
+ pTimer;
sal_uIntPtr nTimeout;
css::uno::Reference<css::io::XInputStream>
- m_xInputStreamToLoadFrom;
- bool m_bIsReadOnly;
+ m_xInputStreamToLoadFrom;
+ bool m_bIsReadOnly;
SvLinkSource_Impl()
: pTimer(nullptr)
@@ -199,7 +200,6 @@ struct SvLinkSource_Impl
SvLinkSource_Impl::~SvLinkSource_Impl()
{
- delete pTimer;
}
SvLinkSource::SvLinkSource()
@@ -279,18 +279,14 @@ void SvLinkSource::SendDataChanged()
}
}
}
- if( pImpl->pTimer )
- {
- delete pImpl->pTimer;
- pImpl->pTimer = nullptr;
- }
+ pImpl->pTimer.reset();
pImpl->aDataMimeType.clear();
}
void SvLinkSource::NotifyDataChanged()
{
if( pImpl->nTimeout )
- StartTimer( &pImpl->pTimer, this, pImpl->nTimeout ); // New timeout
+ StartTimer( pImpl->pTimer, this, pImpl->nTimeout ); // New timeout
else
{
SvLinkSource_EntryIter_Impl aIter( pImpl->aArr );
@@ -313,11 +309,7 @@ void SvLinkSource::NotifyDataChanged()
}
}
- if( pImpl->pTimer )
- {
- delete pImpl->pTimer;
- pImpl->pTimer = nullptr;
- }
+ pImpl->pTimer.reset();
}
}
@@ -330,7 +322,7 @@ void SvLinkSource::DataChanged( const OUString & rMimeType,
{ // only when no data was included
// fire all data to the sink, independent of the requested format
pImpl->aDataMimeType = rMimeType;
- StartTimer( &pImpl->pTimer, this, pImpl->nTimeout ); // New timeout
+ StartTimer( pImpl->pTimer, this, pImpl->nTimeout ); // New timeout
}
else
{
@@ -351,11 +343,7 @@ void SvLinkSource::DataChanged( const OUString & rMimeType,
}
}
- if( pImpl->pTimer )
- {
- delete pImpl->pTimer;
- pImpl->pTimer = nullptr;
- }
+ pImpl->pTimer.reset();
}
}
diff --git a/sfx2/source/appl/lnkbase2.cxx b/sfx2/source/appl/lnkbase2.cxx
index fd0d8fb21e30..44f7e5e28472 100644
--- a/sfx2/source/appl/lnkbase2.cxx
+++ b/sfx2/source/appl/lnkbase2.cxx
@@ -46,7 +46,8 @@ struct BaseLink_Impl
Link<SvBaseLink&,void> m_aEndEditLink;
LinkManager* m_pLinkMgr;
VclPtr<vcl::Window> m_pParentWin;
- FileDialogHelper* m_pFileDlg;
+ std::unique_ptr<FileDialogHelper>
+ m_pFileDlg;
bool m_bIsConnect;
BaseLink_Impl() :
@@ -57,7 +58,7 @@ struct BaseLink_Impl
{}
~BaseLink_Impl()
- { delete m_pFileDlg; }
+ {}
};
// only for internal management
@@ -535,11 +536,9 @@ void SvBaseLink::Closed()
FileDialogHelper & SvBaseLink::GetInsertFileDialog(const OUString& rFactory) const
{
- if ( pImpl->m_pFileDlg )
- delete pImpl->m_pFileDlg;
- pImpl->m_pFileDlg = new FileDialogHelper(
+ pImpl->m_pFileDlg.reset( new FileDialogHelper(
ui::dialogs::TemplateDescription::FILEOPEN_SIMPLE,
- FileDialogFlags::Insert, rFactory);
+ FileDialogFlags::Insert, rFactory) );
return *pImpl->m_pFileDlg;
}