From 0d43f5176d34145b0965fdb2536cd6f454e985c5 Mon Sep 17 00:00:00 2001 From: Stephan Bergmann Date: Thu, 28 Sep 2017 13:59:13 +0200 Subject: Access to ProcessEventsToSignal's bSignal is racy ...so spell out its single use, locking the appropriate mutex around the access Change-Id: I8e8f47de1979f5a80cf1ad65e5ec24d25145c463 Reviewed-on: https://gerrit.libreoffice.org/42908 Tested-by: Jenkins Reviewed-by: Stephan Bergmann --- compilerplugins/clang/constparams.cxx | 2 -- include/vcl/scheduler.hxx | 5 ----- vcl/source/app/svapp.cxx | 5 ----- vcl/source/uitest/uno/uiobject_uno.cxx | 10 +++++++++- 4 files changed, 9 insertions(+), 13 deletions(-) diff --git a/compilerplugins/clang/constparams.cxx b/compilerplugins/clang/constparams.cxx index 024c4d8e3430..62300f4d5eb2 100644 --- a/compilerplugins/clang/constparams.cxx +++ b/compilerplugins/clang/constparams.cxx @@ -181,8 +181,6 @@ bool ConstParams::VisitFunctionDecl(const FunctionDecl * functionDecl) || name == "convert_slashes" // UNO component entry points || name.endswith("component_getFactory") - // in Scheduler::, wants to loop until a reference to a bool becomes true - || name == "ProcessEventsToSignal" // external API || name == "Java_com_sun_star_sdbcx_comp_hsqldb_StorageNativeOutputStream_flush" || name == "egiGraphicExport" diff --git a/include/vcl/scheduler.hxx b/include/vcl/scheduler.hxx index 2d422c6e9678..ac429ed33b09 100644 --- a/include/vcl/scheduler.hxx +++ b/include/vcl/scheduler.hxx @@ -64,11 +64,6 @@ public: * @see Application::Reschedule */ static void ProcessEventsToIdle(); - /** - * Process events until the parameter turns true, - * allows processing until a specific event has been processed - */ - static void ProcessEventsToSignal(bool& bSignal); /// Control the deterministic mode. In this mode, two subsequent runs of /// LibreOffice fire about the same amount idles. diff --git a/vcl/source/app/svapp.cxx b/vcl/source/app/svapp.cxx index be09136b1717..77394497ed18 100644 --- a/vcl/source/app/svapp.cxx +++ b/vcl/source/app/svapp.cxx @@ -486,11 +486,6 @@ bool Application::Reschedule( bool i_bAllEvents ) return ImplYield(false, i_bAllEvents); } -void Scheduler::ProcessEventsToSignal(bool& bSignal) -{ - while (!bSignal && Application::Reschedule() ); -} - void Scheduler::ProcessEventsToIdle() { int nSanity = 1; diff --git a/vcl/source/uitest/uno/uiobject_uno.cxx b/vcl/source/uitest/uno/uiobject_uno.cxx index b68b15aeb5df..a32ff6542198 100644 --- a/vcl/source/uitest/uno/uiobject_uno.cxx +++ b/vcl/source/uitest/uno/uiobject_uno.cxx @@ -96,7 +96,15 @@ IMPL_LINK_NOARG(ExecuteWrapper, ExecuteActionHdl, Timer*, void) aIdle.Start(); } - Scheduler::ProcessEventsToSignal(mbSignal); + for (;;) { + { + std::unique_lock lock(mMutex); + if (mbSignal) { + break; + } + } + Application::Reschedule(); + } std::unique_lock lock(mMutex); while (!mbSignal) { -- cgit