summaryrefslogtreecommitdiff
path: root/sfx2/source
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2018-02-28 14:38:40 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2018-03-05 07:27:45 +0100
commitc2452e52f644649723df10e3cd6bbd48d6bafb49 (patch)
tree5bb1993b265e7a93114c779ac7779ccb33ee9e51 /sfx2/source
parentc9f01cc7855a20b1e0bff662cfbb75fe3665cd8a (diff)
loplugin:useuniqueptr in SfxDispatcher_Impl
Change-Id: I3a468099c1e0a06377df8ad193be3db53c53527d Reviewed-on: https://gerrit.libreoffice.org/50662 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'sfx2/source')
-rw-r--r--sfx2/source/control/dispatch.cxx14
1 files changed, 4 insertions, 10 deletions
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<SfxShell*> SfxShellStack_Impl;
-typedef std::vector<SfxRequest*> 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<std::unique_ptr<SfxRequest>>
+ aReqArr;
SfxShellStack_Impl aStack; // active functionality
Idle aIdle; // for Flush
std::deque<SfxToDo_Impl> 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();
}
}