[Libreoffice-commits] core.git: Branch 'distro/collabora/cp-6.4' - basctl/source basic/source fpicker/source framework/source include/vcl sc/source sfx2/source svx/source sw/source vbahelper/source vcl/source

Noel Grandin (via logerrit) logerrit at kemper.freedesktop.org
Tue Mar 16 06:53:21 UTC 2021


 basctl/source/basicide/baside2.cxx        |    2 +-
 basic/source/classes/sbxmod.cxx           |    2 +-
 basic/source/runtime/methods1.cxx         |    2 +-
 fpicker/source/win32/asyncrequests.cxx    |    2 +-
 framework/source/loadenv/loadenv.cxx      |    2 +-
 include/vcl/svapp.hxx                     |    4 ++++
 sc/source/filter/oox/workbookfragment.cxx |    2 +-
 sfx2/source/doc/docfile.cxx               |    2 +-
 sfx2/source/doc/printhelper.cxx           |    4 ++--
 svx/source/dialog/docrecovery.cxx         |    2 +-
 sw/source/uibase/dbui/dbmgr.cxx           |    2 +-
 vbahelper/source/vbahelper/vbahelper.cxx  |    2 +-
 vcl/source/app/svapp.cxx                  |    5 +++++
 vcl/source/control/prgsbar.cxx            |    2 +-
 vcl/source/window/dialog.cxx              |    2 +-
 vcl/source/window/menufloatingwindow.cxx  |    2 +-
 vcl/source/window/syswin.cxx              |    2 +-
 17 files changed, 25 insertions(+), 16 deletions(-)

New commits:
commit cda7357a82b3be7b60cc314cecbc59922beda629
Author:     Noel Grandin <noelgrandin at gmail.com>
AuthorDate: Sat Mar 13 09:36:46 2021 +0200
Commit:     Noel Grandin <noel.grandin at collabora.co.uk>
CommitDate: Tue Mar 16 07:52:46 2021 +0100

    check for quit when calling Yield in loop
    
    so we don't get stuck threads when the main application
    quits
    
    Change-Id: Id36e99267ceb4154873b6ef8ef494622fff6c19a
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/112409
    Tested-by: Jenkins
    Reviewed-by: Michael Meeks <michael.meeks at collabora.com>
    (cherry picked from commit c880d3e30405342a5ae6239cc77f69ed3ca6cc15)
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/112491
    Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice at gmail.com>
    Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>

diff --git a/basctl/source/basicide/baside2.cxx b/basctl/source/basicide/baside2.cxx
index 4a9fc67c94d0..a49def4b0fe5 100644
--- a/basctl/source/basicide/baside2.cxx
+++ b/basctl/source/basicide/baside2.cxx
@@ -676,7 +676,7 @@ BasicDebugFlags ModulWindow::BasicBreakHdl()
 
     InvalidateDebuggerSlots();
 
-    while( m_aStatus.bIsRunning )
+    while( m_aStatus.bIsRunning && !Application::IsQuit())
         Application::Yield();
 
     m_aStatus.bIsInReschedule = false;
diff --git a/basic/source/classes/sbxmod.cxx b/basic/source/classes/sbxmod.cxx
index 0596e5ba87d9..c4e42b67b85c 100644
--- a/basic/source/classes/sbxmod.cxx
+++ b/basic/source/classes/sbxmod.cxx
@@ -1122,7 +1122,7 @@ void SbModule::Run( SbMethod* pMeth )
             if( bDelInst )
             {
                 // Compare here with 1 instead of 0, because before nCallLvl--
-                while (pSbData->pInst->nCallLvl != 1)
+                while (pSbData->pInst->nCallLvl != 1 && !Application::IsQuit())
                     Application::Yield();
             }
 
diff --git a/basic/source/runtime/methods1.cxx b/basic/source/runtime/methods1.cxx
index 19f0acaa8c0a..f0f1e3ded591 100644
--- a/basic/source/runtime/methods1.cxx
+++ b/basic/source/runtime/methods1.cxx
@@ -582,7 +582,7 @@ void Wait_Impl( bool bDurationBased, SbxArray& rPar )
     Timer aTimer;
     aTimer.SetTimeout( nWait );
     aTimer.Start();
-    while ( aTimer.IsActive() )
+    while ( aTimer.IsActive() && !Application::IsQuit())
     {
         Application::Yield();
     }
diff --git a/fpicker/source/win32/asyncrequests.cxx b/fpicker/source/win32/asyncrequests.cxx
index 86b71cf51540..bfecc42125a3 100644
--- a/fpicker/source/win32/asyncrequests.cxx
+++ b/fpicker/source/win32/asyncrequests.cxx
@@ -50,7 +50,7 @@ void Request::wait( ::sal_Int32 nMilliSeconds )
 void Request::waitProcessMessages()
 {
     SolarMutexGuard aGuard;
-    while ( !m_aJoiner.check() )
+    while ( !m_aJoiner.check() && !Application::IsQuit())
         Application::Yield();
 }
 
diff --git a/framework/source/loadenv/loadenv.cxx b/framework/source/loadenv/loadenv.cxx
index 3d04e17a23c2..dea965f01409 100644
--- a/framework/source/loadenv/loadenv.cxx
+++ b/framework/source/loadenv/loadenv.cxx
@@ -413,7 +413,7 @@ bool LoadEnv::waitWhileLoading(sal_uInt32 nTimeout)
     // in an intelligent manner :-)
 
     sal_Int32 nTime = nTimeout;
-    while(true)
+    while(!Application::IsQuit())
     {
         // SAFE -> ------------------------------
         {
diff --git a/include/vcl/svapp.hxx b/include/vcl/svapp.hxx
index a0a5b53144c2..e81cff4e4096 100644
--- a/include/vcl/svapp.hxx
+++ b/include/vcl/svapp.hxx
@@ -462,6 +462,10 @@ public:
     */
     static void                 Quit();
 
+    /** Has Quit() been called?
+    */
+    static bool                 IsQuit();
+
     /** Attempt to process current pending event(s)
 
      It doesn't sleep if no events are available for processing.
diff --git a/sc/source/filter/oox/workbookfragment.cxx b/sc/source/filter/oox/workbookfragment.cxx
index 4146a60eb310..d9f20cbedb77 100644
--- a/sc/source/filter/oox/workbookfragment.cxx
+++ b/sc/source/filter/oox/workbookfragment.cxx
@@ -329,7 +329,7 @@ void importSheetFragments( WorkbookFragment& rWorkbookHandler, SheetFragmentVect
     }
 
     // coverity[loop_top] - this isn't an infinite loop where nSheetsLeft gets decremented by the above threads
-    while( nSheetsLeft > 0)
+    while( nSheetsLeft > 0 && !Application::IsQuit())
     {
         // This is a much more controlled re-enterancy hazard than
         // allowing a yield deeper inside the filter code for progress
diff --git a/sfx2/source/doc/docfile.cxx b/sfx2/source/doc/docfile.cxx
index ae24bf153ea2..afcb06d08478 100644
--- a/sfx2/source/doc/docfile.cxx
+++ b/sfx2/source/doc/docfile.cxx
@@ -2750,7 +2750,7 @@ void SfxMedium::Download( const Link<void*,void>& aLink )
     GetInStream();
     if ( pImpl->m_pInStream && !aLink.IsSet() )
     {
-        while( !pImpl->bDownloadDone )
+        while( !pImpl->bDownloadDone && !Application::IsQuit())
             Application::Yield();
     }
 }
diff --git a/sfx2/source/doc/printhelper.cxx b/sfx2/source/doc/printhelper.cxx
index 661074a9a102..7be718388e26 100644
--- a/sfx2/source/doc/printhelper.cxx
+++ b/sfx2/source/doc/printhelper.cxx
@@ -436,7 +436,7 @@ void SfxPrintHelper::impl_setPrinter(const uno::Sequence< beans::PropertyValue >
 
     //wait until printing is done
     SfxPrinter* pDocPrinter = pViewSh->GetPrinter();
-    while ( pDocPrinter->IsPrinting() )
+    while ( pDocPrinter->IsPrinting() && !Application::IsQuit())
         Application::Yield();
 }
 
@@ -491,7 +491,7 @@ class ImplUCBPrintWatcher : public ::osl::Thread
             /* SAFE { */
             {
                 SolarMutexGuard aGuard;
-                while( m_pPrinter->IsPrinting() )
+                while( m_pPrinter->IsPrinting() && !Application::IsQuit())
                     Application::Yield();
                 m_pPrinter.clear(); // don't delete it! It's borrowed only :-)
             }
diff --git a/svx/source/dialog/docrecovery.cxx b/svx/source/dialog/docrecovery.cxx
index cdefa9972966..f946a034429d 100644
--- a/svx/source/dialog/docrecovery.cxx
+++ b/svx/source/dialog/docrecovery.cxx
@@ -729,7 +729,7 @@ short RecoveryDialog::execute()
                 m_pCore->doRecovery();
 
                 m_bWaitForCore = true;
-                while(m_bWaitForCore)
+                while(m_bWaitForCore && !Application::IsQuit())
                     Application::Yield();
 
                 m_pCore->setUpdateListener(nullptr);
diff --git a/sw/source/uibase/dbui/dbmgr.cxx b/sw/source/uibase/dbui/dbmgr.cxx
index c5f726758fb1..e83727fee73f 100644
--- a/sw/source/uibase/dbui/dbmgr.cxx
+++ b/sw/source/uibase/dbui/dbmgr.cxx
@@ -1705,7 +1705,7 @@ bool SwDBManager::MergeMailFiles(SwWrtShell* pSourceShell,
                     "sw::SwDBManager aEmailDispatcherPollTimer" );
                 aEmailDispatcherPollTimer.SetTimeout( 500 );
                 aEmailDispatcherPollTimer.Start();
-                while( IsMergeOk() && m_pImpl->m_xLastMessage.is() )
+                while( IsMergeOk() && m_pImpl->m_xLastMessage.is() && !Application::IsQuit())
                     Application::Yield();
                 aEmailDispatcherPollTimer.Stop();
             }
diff --git a/vbahelper/source/vbahelper/vbahelper.cxx b/vbahelper/source/vbahelper/vbahelper.cxx
index ee55df6b651e..0c0462115ad6 100644
--- a/vbahelper/source/vbahelper/vbahelper.cxx
+++ b/vbahelper/source/vbahelper/vbahelper.cxx
@@ -445,7 +445,7 @@ void PrintPreviewHelper( const css::uno::Any& /*EnableChanges*/, SfxViewShell co
 
 void WaitUntilPreviewIsClosed( SfxViewFrame* pViewFrame )
 {
-    while ( pViewFrame && isInPrintPreview( pViewFrame ) )
+    while ( pViewFrame && isInPrintPreview( pViewFrame ) && !Application::IsQuit())
         Application::Yield();
 }
 
diff --git a/vcl/source/app/svapp.cxx b/vcl/source/app/svapp.cxx
index 34227013dc23..5831987937f7 100644
--- a/vcl/source/app/svapp.cxx
+++ b/vcl/source/app/svapp.cxx
@@ -572,6 +572,11 @@ bool Application::IsInExecute()
     return ImplGetSVData()->maAppData.mbInAppExecute;
 }
 
+bool Application::IsQuit()
+{
+    return ImplGetSVData()->maAppData.mbAppQuit;
+}
+
 bool Application::IsInModalMode()
 {
     return (ImplGetSVData()->maAppData.mnModalMode != 0);
diff --git a/vcl/source/control/prgsbar.cxx b/vcl/source/control/prgsbar.cxx
index 16ec32de0597..d99ade44ec88 100644
--- a/vcl/source/control/prgsbar.cxx
+++ b/vcl/source/control/prgsbar.cxx
@@ -182,7 +182,7 @@ void ProgressBar::SetValue( sal_uInt16 nNewPercent )
         Idle aIdle("ProgressBar::SetValue aIdle");
         aIdle.SetPriority(TaskPriority::POST_PAINT);
         aIdle.Start();
-        while (aIdle.IsActive())
+        while (aIdle.IsActive() && !Application::IsQuit())
         {
             Application::Yield();
         }
diff --git a/vcl/source/window/dialog.cxx b/vcl/source/window/dialog.cxx
index 83fa562023ce..bf6bf188f14c 100644
--- a/vcl/source/window/dialog.cxx
+++ b/vcl/source/window/dialog.cxx
@@ -1050,7 +1050,7 @@ short Dialog::Execute()
 
     // Yield util EndDialog is called or dialog gets destroyed
     // (the latter should not happen, but better safe than sorry
-    while ( !xWindow->IsDisposed() && mbInExecute )
+    while ( !xWindow->IsDisposed() && mbInExecute && !Application::IsQuit() )
         Application::Yield();
 
     ImplEndExecuteModal();
diff --git a/vcl/source/window/menufloatingwindow.cxx b/vcl/source/window/menufloatingwindow.cxx
index 753c3b7282ff..cd95b076ac3d 100644
--- a/vcl/source/window/menufloatingwindow.cxx
+++ b/vcl/source/window/menufloatingwindow.cxx
@@ -455,7 +455,7 @@ void MenuFloatingWindow::Execute()
 
     Start();
 
-    while (bInExecute)
+    while (bInExecute && !Application::IsQuit())
         Application::Yield();
 
     pSVData->maAppData.mpActivePopupMenu = nullptr;
diff --git a/vcl/source/window/syswin.cxx b/vcl/source/window/syswin.cxx
index 9d2a0b671c66..f0f1e1744749 100644
--- a/vcl/source/window/syswin.cxx
+++ b/vcl/source/window/syswin.cxx
@@ -1188,7 +1188,7 @@ void SystemWindow::ensureRepaint()
     Invalidate();
     mbPaintComplete = false;
 
-    while (!mbPaintComplete)
+    while (!mbPaintComplete && !Application::IsQuit())
     {
         Application::Yield();
     }


More information about the Libreoffice-commits mailing list