[Libreoffice-commits] core.git: sfx2/source
Noel Grandin
noel.grandin at collabora.co.uk
Mon Mar 5 06:28:07 UTC 2018
sfx2/source/control/dispatch.cxx | 14 ++++----------
1 file changed, 4 insertions(+), 10 deletions(-)
New commits:
commit c2452e52f644649723df10e3cd6bbd48d6bafb49
Author: Noel Grandin <noel.grandin at collabora.co.uk>
Date: Wed Feb 28 14:38:40 2018 +0200
loplugin:useuniqueptr in SfxDispatcher_Impl
Change-Id: I3a468099c1e0a06377df8ad193be3db53c53527d
Reviewed-on: https://gerrit.libreoffice.org/50662
Tested-by: Jenkins <ci at libreoffice.org>
Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>
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();
}
}
More information about the Libreoffice-commits
mailing list