sw/source/uibase/uno/unotxdoc.cxx | 6 ++++++ 1 file changed, 6 insertions(+)
New commits: commit 1482b0166dda75c978752ea93b0cd9b76315d384 Author: Michael Stahl <michael.st...@allotropia.de> AuthorDate: Thu Nov 4 18:50:42 2021 +0100 Commit: Caolán McNamara <caol...@redhat.com> CommitDate: Sat Nov 6 17:01:41 2021 +0100 tdf#144989 sw: disable idle jobs during printing or PDF export The problem is that (with the kde5 and WNT vclplugs) the idle jobs update fields and un-hides every section, which destroys the layout that SwXTextDocument::getRendererCount() finalised with great effort. This doesn't seem to happen with gtk3 or gen vclplugs. 6 SwSectionNode::MakeOwnFrames(SwNodeIndex*, SwNodeIndex*) 7 SwSectionFormat::MakeFrames() 8 SwSection::ImplSetHiddenFlag(bool, bool) 9 SwSection::SetCondHidden(bool) 10 SwDocUpdateField::MakeFieldList_(SwDoc&, int) 11 SwDocUpdateField::MakeFieldList(SwDoc&, bool, int) 12 sw::DocumentFieldsManager::UpdateExpFields(SwTextField*, bool) 13 sw::DocumentTimerManager::DoIdleJobs(Timer*) 14 sw::DocumentTimerManager::LinkStubDoIdleJobs(void*, Timer*) 15 Link<Timer*, void>::Call(Timer*) const 16 Timer::Invoke() 17 Scheduler::CallbackTaskScheduling() () 18 SalTimer::CallCallback() 19 QtTimer::timeoutActivated() 20 QtTimer::qt_static_metacall(QObject*, QMetaObject::Call, int, void**) 21 void doActivate<false>(QObject*, int, void**) () 22 QTimer::timeout(QTimer::QPrivateSignal) () 23 QObject::event(QEvent*) () 24 QApplicationPrivate::notify_helper(QObject*, QEvent*) () 25 QCoreApplication::notifyInternal2(QObject*, QEvent*) () 26 QTimerInfoList::activateTimers() () 27 timerSourceDispatch() 28 g_main_context_dispatch () 29 g_main_context_iterate.constprop () 30 g_main_context_iteration () 31 QEventDispatcherGlib::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) () 32 QtInstance::ImplYield(bool, bool) 33 QtInstance::DoYield(bool, bool) 34 ImplYield(bool, bool) 35 Application::Reschedule(bool) 36 framework::StatusIndicatorFactory::impl_reschedule(bool) 37 framework::StatusIndicatorFactory::setValue() 38 framework::StatusIndicator::setValue(int) 39 PDFExport::ExportSelection() 40 PDFExport::Export() Reportedly this started to happen with commit 4184569b963877c2a488ff05766654b9db194798 - presumably before that the word counting was so slow that the idle didn't progress to updating fields. There is little point in running idle jobs during printing anyway as in the best case it will just slow down the process. So temporarily disable the idle jobs in getRendererCount() and enable it again in render() with "IsLastPage" set. Change-Id: I6359592aefeec298c5e58d44bef5ef16c583ddac Reviewed-on: https://gerrit.libreoffice.org/c/core/+/124721 Tested-by: Jenkins Reviewed-by: Michael Stahl <michael.st...@allotropia.de> (cherry picked from commit 20ddabc88b6b45ea3efcc44ede5244ea526b09c4) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/124693 Reviewed-by: Caolán McNamara <caol...@redhat.com> (cherry picked from commit 73d3639304100d50422435745f8ecc7ff1583de1) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/124694 Reviewed-by: Xisco Fauli <xiscofa...@libreoffice.org> Reviewed-by: Thorsten Behrens <thorsten.behr...@allotropia.de> Tested-by: Caolán McNamara <caol...@redhat.com> diff --git a/sw/source/uibase/uno/unotxdoc.cxx b/sw/source/uibase/uno/unotxdoc.cxx index 890ccdd8fcc3..326787dea7b5 100644 --- a/sw/source/uibase/uno/unotxdoc.cxx +++ b/sw/source/uibase/uno/unotxdoc.cxx @@ -2635,6 +2635,10 @@ sal_Int32 SAL_CALL SwXTextDocument::getRendererCount( } } OSL_ENSURE( nRet >= 0, "negative number of pages???" ); + // tdf#144989 the layout is complete now - prevent DoIdleJobs() from + // messing it up, particulary SwDocUpdateField::MakeFieldList_() unhiding + // sections + pDoc->getIDocumentTimerAccess().BlockIdling(); return nRet; } @@ -3060,6 +3064,8 @@ void SAL_CALL SwXTextDocument::render( { m_pRenderData.reset(); m_pPrintUIOptions.reset(); + // tdf#144989 enable DoIdleJobs() again after last page + pDoc->getIDocumentTimerAccess().UnblockIdling(); } }