diff options
author | Jan-Marek Glogowski <glogow@fbihome.de> | 2017-08-29 10:29:51 +0200 |
---|---|---|
committer | Jan-Marek Glogowski <glogow@fbihome.de> | 2017-09-26 13:53:28 +0200 |
commit | 9679fb26558ea42e47ac9936cef329115a8fdf65 (patch) | |
tree | eee6c65d50667fc5b9924f98ce8f87a6df9d707a /sw | |
parent | 808d048694630303d895e818cfd5fb48c9d16738 (diff) |
tdf#112288 Clarify Reschedule implementations
Application::Reschedule(true) must just process all currently
pending events and ignore all new events generated while processing
them. In contrast to Scheduler::ProcessEventsToIdle, this way it
can't busy-lock the application with background jobs.
This way we also can drop nMaxEvents from the Windows backend. This
limit was also never implemented on OSX and for the KDE4 backend
it's actually impossible to handle single events, and a call to
QAbstractEventDispatcher::processEvents works like this.
Also changes various call sites to just process all pending events
instead of some made up number of times.
Change-Id: I1ab95df89b079cc8c6319a808194fe3127144d1c
Reviewed-on: https://gerrit.libreoffice.org/42659
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Jan-Marek Glogowski <glogow@fbihome.de>
Diffstat (limited to 'sw')
-rw-r--r-- | sw/source/ui/dbui/addresslistdialog.cxx | 3 | ||||
-rw-r--r-- | sw/source/ui/dbui/mmresultdialogs.cxx | 9 | ||||
-rw-r--r-- | sw/source/uibase/dbui/dbmgr.cxx | 15 |
3 files changed, 9 insertions, 18 deletions
diff --git a/sw/source/ui/dbui/addresslistdialog.cxx b/sw/source/ui/dbui/addresslistdialog.cxx index 254bf5a1cd68..2f80c7db6823 100644 --- a/sw/source/ui/dbui/addresslistdialog.cxx +++ b/sw/source/ui/dbui/addresslistdialog.cxx @@ -487,8 +487,7 @@ IMPL_LINK(SwAddressListDialog, StaticListBoxSelectHdl_Impl, void*, p, void) m_pListLB->SetEntryText(m_sConnecting, pSelect, ITEMID_TABLE - 1); // allow painting of the new entry m_pListLB->Window::Invalidate(InvalidateFlags::Update); - for (int i = 0; i < 10; ++i) - Application::Reschedule(); + Application::Reschedule( true ); } pUserData = static_cast<AddressUserData_Impl*>(pSelect->GetUserData()); diff --git a/sw/source/ui/dbui/mmresultdialogs.cxx b/sw/source/ui/dbui/mmresultdialogs.cxx index 31e64f75a7a7..e24e73121b86 100644 --- a/sw/source/ui/dbui/mmresultdialogs.cxx +++ b/sw/source/ui/dbui/mmresultdialogs.cxx @@ -717,8 +717,7 @@ IMPL_LINK(SwMMResultSaveDialog, SaveOutputHdl_Impl, Button*, pButton, void) while(true) { //time for other slots is needed - for(sal_Int16 r = 0; r < 10; ++r) - Application::Reschedule(); + Application::Reschedule( true ); bool bFailed = false; try { @@ -1086,8 +1085,7 @@ IMPL_LINK(SwMMResultEmailDialog, SendDocumentsHdl_Impl, Button*, pButton, void) //help to force painting the dialog //TODO/CLEANUP //predetermined breaking point - for ( sal_Int16 i = 0; i < 25; i++) - Application::Reschedule(); + Application::Reschedule( true ); for(sal_uInt32 nDoc = nBegin; nDoc < nEnd; ++nDoc) { SwDocMergeInfo& rInfo = xConfigItem->GetDocumentMergeInfo(nDoc); @@ -1229,8 +1227,7 @@ IMPL_LINK(SwMMResultEmailDialog, SendDocumentsHdl_Impl, Button*, pButton, void) aDesc.sBCC = m_sBCC; pDlg->AddDocument( aDesc ); //help to force painting the dialog - for ( sal_Int16 i = 0; i < 25; i++) - Application::Reschedule(); + Application::Reschedule( true ); //stop creating of data when dialog has been closed if(!pDlg->IsVisible()) { diff --git a/sw/source/uibase/dbui/dbmgr.cxx b/sw/source/uibase/dbui/dbmgr.cxx index 2285695fba2f..1c3d6a56679f 100644 --- a/sw/source/uibase/dbui/dbmgr.cxx +++ b/sw/source/uibase/dbui/dbmgr.cxx @@ -147,11 +147,6 @@ using namespace ::com::sun::star; namespace { -void rescheduleGui() { - for( sal_uInt16 i = 0; i < 25; i++) - Application::Reschedule(); -} - void lcl_emitEvent(SfxEventHintId nEventId, sal_Int32 nStrId, SfxObjectShell* pDocShell) { SfxGetpApp()->NotifyEvent(SfxEventHint(nEventId, @@ -1261,7 +1256,7 @@ bool SwDBManager::MergeMailFiles(SwWrtShell* pSourceShell, pProgressDlg->SetCancelHdl( LINK(this, SwDBManager, PrtCancelHdl) ); pProgressDlg->Show(); - rescheduleGui(); + Application::Reschedule( true ); } if( bCreateSingleFile && !pTargetView ) @@ -1404,7 +1399,7 @@ bool SwDBManager::MergeMailFiles(SwWrtShell* pSourceShell, pProgressDlg->Update(); } - rescheduleGui(); + Application::Reschedule( true ); // Create a copy of the source document and work with that one instead of the source. // If we're not in the single file mode (which requires modifying the document for the merging), @@ -1574,7 +1569,7 @@ bool SwDBManager::MergeMailFiles(SwWrtShell* pSourceShell, } else if( IsMergeOk() ) // && bCreateSingleFile { - rescheduleGui(); + Application::Reschedule( true ); // sw::DocumentLayoutManager::CopyLayoutFormat() did not generate // unique fly names, do it here once. @@ -1593,7 +1588,7 @@ bool SwDBManager::MergeMailFiles(SwWrtShell* pSourceShell, aLayout->AllCheckPageDescs(); } - rescheduleGui(); + Application::Reschedule( true ); if( IsMergeOk() && bMT_FILE ) { @@ -1631,7 +1626,7 @@ bool SwDBManager::MergeMailFiles(SwWrtShell* pSourceShell, else if( xTargetDocShell.is() ) xTargetDocShell->DoClose(); - rescheduleGui(); + Application::Reschedule( true ); pProgressDlg.disposeAndClear(); |