desktop/source/lib/init.cxx | 15 ++++++++++++--- framework/inc/helper/statusindicatorfactory.hxx | 9 ++++++++- framework/source/helper/statusindicatorfactory.cxx | 11 +++++++++++ 3 files changed, 31 insertions(+), 4 deletions(-)
New commits: commit b707ca9651a3d1b679b81b7d2aec1baf3d596090 Author: Michael Meeks <michael.me...@collabora.com> AuthorDate: Fri May 24 21:45:44 2024 +0100 Commit: Caolán McNamara <caolan.mcnam...@collabora.com> CommitDate: Sun Jul 28 17:22:54 2024 +0200 cool#9082 - lok: cleanup WakeUpThread before forking, then re-start. It seems likely that this lingering briefly after various un-identified and tough to reproduce, longer running operations in calc - which is a big ScProgress user - caused problems with background save. Change-Id: I1d0ec56c759dff30c48c8562b6400b57be4a25b2 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/168033 Reviewed-by: Caolán McNamara <caolan.mcnam...@collabora.com> Tested-by: Caolán McNamara <caolan.mcnam...@collabora.com> Reviewed-on: https://gerrit.libreoffice.org/c/core/+/168052 Tested-by: Jenkins diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx index 442d88eaeecf..4fab9477f330 100644 --- a/desktop/source/lib/init.cxx +++ b/desktop/source/lib/init.cxx @@ -3435,9 +3435,6 @@ static int lo_joinThreads(LibreOfficeKit* /* pThis */) comphelper::ThreadPool &pool = comphelper::ThreadPool::getSharedOptimalPool(); pool.joinThreadsIfIdle(); -// if (comphelper::getWorkerCount() > 0) -// return 0; - // Grammar checker thread css::uno::Reference<css::linguistic2::XLinguServiceManager2> xLangSrv = css::linguistic2::LinguServiceManager::create(xContext); @@ -3452,6 +3449,12 @@ static int lo_joinThreads(LibreOfficeKit* /* pThis */) if (joinable && !joinable->joinThreads()) return 0; + auto progressThread = xContext->getServiceManager()->createInstanceWithContext( + "com.sun.star.task.StatusIndicatorFactory", xContext); + joinable = dynamic_cast<comphelper::LibreOfficeKit::ThreadJoinable *>(progressThread.get()); + if (joinable && !joinable->joinThreads()) + return 0; + // Ensure configmgr's write thread is down css::uno::Reference< css::util::XFlushable >( css::configuration::theDefaultProvider::get( @@ -3468,6 +3471,12 @@ static void lo_startThreads(LibreOfficeKit* /* pThis */) auto joinable = dynamic_cast<comphelper::LibreOfficeKit::ThreadJoinable *>(ucpWebdav.get()); if (joinable) joinable->startThreads(); + + auto progressThread = xContext->getServiceManager()->createInstanceWithContext( + "com.sun.star.task.StatusIndicatorFactory", xContext); + joinable = dynamic_cast<comphelper::LibreOfficeKit::ThreadJoinable *>(progressThread.get()); + if (joinable) + joinable->startThreads(); } static void lo_setForkedChild(LibreOfficeKit* /* pThis */, bool bIsChild) diff --git a/framework/inc/helper/statusindicatorfactory.hxx b/framework/inc/helper/statusindicatorfactory.hxx index 1bb07f1a0c08..4d10a52a70b6 100644 --- a/framework/inc/helper/statusindicatorfactory.hxx +++ b/framework/inc/helper/statusindicatorfactory.hxx @@ -39,6 +39,7 @@ #include <cppuhelper/supportsservice.hxx> #include <cppuhelper/implbase.hxx> +#include <comphelper/lok.hxx> #include <rtl/ref.hxx> namespace framework{ @@ -120,7 +121,8 @@ class StatusIndicatorFactory final : public ::cppu::WeakImplHelper< css::lang::XServiceInfo , css::lang::XInitialization , css::task::XStatusIndicatorFactory - , css::util::XUpdatable > + , css::util::XUpdatable >, + public comphelper::LibreOfficeKit::ThreadJoinable { // member @@ -211,6 +213,11 @@ class StatusIndicatorFactory final : public ::cppu::WeakImplHelper< void setValue(const css::uno::Reference< css::task::XStatusIndicator >& xChild, sal_Int32 nValue); + // comphelper::LibreOfficeKit::ThreadJoinable + virtual bool joinThreads() override; + + virtual void startThreads() override; + // specials private: diff --git a/framework/source/helper/statusindicatorfactory.cxx b/framework/source/helper/statusindicatorfactory.cxx index 6bf526e340b4..a2a91e6f32fe 100644 --- a/framework/source/helper/statusindicatorfactory.cxx +++ b/framework/source/helper/statusindicatorfactory.cxx @@ -286,6 +286,17 @@ void StatusIndicatorFactory::setValue( const css::uno::Reference< css::task::XSt impl_reschedule(false); } +bool StatusIndicatorFactory::joinThreads() +{ + WakeUpThread::joinThread(); + return true; +} + +void StatusIndicatorFactory::startThreads() +{ + WakeUpThread::startThread(); +} + void StatusIndicatorFactory::implts_makeParentVisibleIfAllowed() { css::uno::Reference< css::frame::XFrame > xFrame;