From c2452e52f644649723df10e3cd6bbd48d6bafb49 Mon Sep 17 00:00:00 2001 From: Noel Grandin Date: Wed, 28 Feb 2018 14:38:40 +0200 Subject: loplugin:useuniqueptr in SfxDispatcher_Impl Change-Id: I3a468099c1e0a06377df8ad193be3db53c53527d Reviewed-on: https://gerrit.libreoffice.org/50662 Tested-by: Jenkins Reviewed-by: Noel Grandin --- sfx2/source/control/dispatch.cxx | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) (limited to 'sfx2/source') diff --git a/sfx2/source/control/dispatch.cxx b/sfx2/source/control/dispatch.cxx index b05bffb1030c..07b251f552e4 100644 --- a/sfx2/source/control/dispatch.cxx +++ b/sfx2/source/control/dispatch.cxx @@ -74,8 +74,6 @@ typedef std::vector SfxShellStack_Impl; -typedef std::vector SfxRequestPtrArray; - struct SfxToDo_Impl { SfxShell* pCluster; @@ -110,12 +108,8 @@ struct SfxDispatcher_Impl //The pointers are typically deleted in Post, only if we never get around //to posting them do we delete the unposted requests. - SfxRequestPtrArray aReqArr; - ~SfxDispatcher_Impl() - { - for (auto const& req : aReqArr) - delete req; - } + std::vector> + aReqArr; SfxShellStack_Impl aStack; // active functionality Idle aIdle; // for Flush std::deque aToDoStack; // not processed Push/Pop @@ -1138,7 +1132,7 @@ IMPL_LINK(SfxDispatcher, PostMsgHandler, SfxRequest*, pReq, void) else { if ( xImp->bLocked ) - xImp->aReqArr.push_back(new SfxRequest(*pReq)); + xImp->aReqArr.emplace_back(new SfxRequest(*pReq)); else xImp->xPoster->Post(new SfxRequest(*pReq)); } @@ -1965,7 +1959,7 @@ void SfxDispatcher::Lock( bool bLock ) if ( !bLock ) { for(size_t i = 0; i < xImp->aReqArr.size(); ++i) - xImp->xPoster->Post(xImp->aReqArr[i]); + xImp->xPoster->Post(xImp->aReqArr[i].get()); xImp->aReqArr.clear(); } } -- cgit