[Libreoffice-commits] core.git: sd/source
Jan Holesovsky
kendy at collabora.com
Thu Jan 25 09:05:37 UTC 2018
sd/source/ui/func/futransf.cxx | 32 +++++++-------------------------
1 file changed, 7 insertions(+), 25 deletions(-)
New commits:
commit 9f05a323d50c6750e25f2ca69f758ec7fc4313bc
Author: Jan Holesovsky <kendy at collabora.com>
Date: Wed Jan 24 13:19:41 2018 +0100
sd: Kill an own scope guard impl. and use comphelper::ScopeGuard instead.
Change-Id: I769c1c6c9d10081b706d0e1e0fbd7ad373a6e04f
Reviewed-on: https://gerrit.libreoffice.org/48499
Reviewed-by: Jan Holesovsky <kendy at collabora.com>
Tested-by: Jan Holesovsky <kendy at collabora.com>
diff --git a/sd/source/ui/func/futransf.cxx b/sd/source/ui/func/futransf.cxx
index f62c9788da8a..9dddef1dde4b 100644
--- a/sd/source/ui/func/futransf.cxx
+++ b/sd/source/ui/func/futransf.cxx
@@ -19,6 +19,7 @@
#include <futransf.hxx>
+#include <comphelper/scopeguard.hxx>
#include <svx/dialogs.hrc>
#include <vcl/msgbox.hxx>
#include <sfx2/request.hxx>
@@ -61,34 +62,15 @@ void setUndo(::sd::View* pView, const SfxItemSet* pArgs)
pView->EndUndo();
}
-class ScopeCleanup
-{
- ViewShell* mpViewShell;
-public:
- ScopeCleanup(ViewShell* pViewShell) : mpViewShell(pViewShell)
- {
- }
-
- ~ScopeCleanup()
- {
- if (mpViewShell)
- {
- mpViewShell->Invalidate(SID_RULER_OBJECT);
- mpViewShell->Cancel();
- }
- }
-
- void ignore()
- {
- mpViewShell = nullptr;
- }
-};
-
}
void FuTransform::DoExecute( SfxRequest& rReq )
{
- ScopeCleanup aCleanup(mpViewShell);
+ comphelper::ScopeGuard guard([&]() {
+ // cleanup when leaving
+ mpViewShell->Invalidate(SID_RULER_OBJECT);
+ mpViewShell->Cancel();
+ });
if (!mpView->AreObjectsMarked())
return;
@@ -141,7 +123,7 @@ void FuTransform::DoExecute( SfxRequest& rReq )
std::shared_ptr<SfxRequest> pRequest(new SfxRequest(rReq));
rReq.Ignore(); // the 'old' request is not relevant any more
- aCleanup.ignore(); // the lambda does it
+ guard.dismiss(); // we'll invalidate explicitly after the dialog ends
pDlg->StartExecuteAsync([=](sal_Int32 nResult){
if (nResult == RET_OK)
More information about the Libreoffice-commits
mailing list