[Libreoffice-commits] core.git: vcl/source

Stephan Bergmann (via logerrit) logerrit at kemper.freedesktop.org
Mon Jun 28 14:55:42 UTC 2021


 vcl/source/uitest/uno/uiobject_uno.cxx |    8 +++-----
 vcl/source/uitest/uno/uiobject_uno.hxx |    3 ---
 2 files changed, 3 insertions(+), 8 deletions(-)

New commits:
commit 936298c38b6f7007097700e5862db00da89d0334
Author:     Stephan Bergmann <sbergman at redhat.com>
AuthorDate: Mon Jun 28 16:01:42 2021 +0200
Commit:     Stephan Bergmann <sbergman at redhat.com>
CommitDate: Mon Jun 28 16:55:05 2021 +0200

    No need for these function arguments to be captured in UIObjectUnoObj
    
    The lambda that uses them will never outlive the invocation of
    UIObjectUnoObj::executeAction.
    
    Change-Id: Icc5098a99389f7c70b69ca790acb4709f55b4dad
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/118025
    Tested-by: Jenkins
    Reviewed-by: Stephan Bergmann <sbergman at redhat.com>

diff --git a/vcl/source/uitest/uno/uiobject_uno.cxx b/vcl/source/uitest/uno/uiobject_uno.cxx
index 14a50f08c7b7..fe7a3d9901d7 100644
--- a/vcl/source/uitest/uno/uiobject_uno.cxx
+++ b/vcl/source/uitest/uno/uiobject_uno.cxx
@@ -106,18 +106,16 @@ void SAL_CALL UIObjectUnoObj::executeAction(const OUString& rAction, const css::
         throw css::uno::RuntimeException();
 
     std::unique_lock<std::mutex> lk(mMutex);
-    mAction = rAction;
-    mPropValues = rPropValues;
     mReady = false;
     auto aIdle = std::make_unique<Idle>();
     aIdle->SetDebugName("UI Test Idle Handler");
     aIdle->SetPriority(TaskPriority::HIGHEST);
 
-    std::function<void()> func = [this](){
+    std::function<void()> func = [&rAction, &rPropValues, this](){
 
         SolarMutexGuard aGuard;
         StringMap aMap;
-        for (const auto& rPropVal : std::as_const(mPropValues))
+        for (const auto& rPropVal : rPropValues)
         {
             OUString aVal;
             if (!(rPropVal.Value >>= aVal))
@@ -125,7 +123,7 @@ void SAL_CALL UIObjectUnoObj::executeAction(const OUString& rAction, const css::
 
             aMap[rPropVal.Name] = aVal;
         }
-        mpObj->execute(mAction, aMap);
+        mpObj->execute(rAction, aMap);
     };
 
     ExecuteWrapper* pWrapper = new ExecuteWrapper(func, LINK(this, UIObjectUnoObj, NotifyHdl));
diff --git a/vcl/source/uitest/uno/uiobject_uno.hxx b/vcl/source/uitest/uno/uiobject_uno.hxx
index f2e6d3e2b786..a9f2a294d9e3 100644
--- a/vcl/source/uitest/uno/uiobject_uno.hxx
+++ b/vcl/source/uitest/uno/uiobject_uno.hxx
@@ -63,9 +63,6 @@ private:
     std::condition_variable cv;
     std::mutex mMutex;
     bool mReady;
-
-    OUString mAction;
-    css::uno::Sequence<css::beans::PropertyValue> mPropValues;
 };
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */


More information about the Libreoffice-commits mailing list