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.mcnamara@collabora.com>
Tested-by: Caolán McNamara <caolan.mcnamara@collabora.com>
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/168052
Tested-by: Jenkins
This commit is contained in:
Michael Meeks
2024-07-28 17:22:54 +02:00
committed by Caolán McNamara
parent c658efe24f
commit b707ca9651
3 changed files with 31 additions and 4 deletions
+12 -3
View File
@@ -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)
@@ -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:
@@ -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;