diff options
author | Noel Grandin <noelgrandin@gmail.com> | 2021-03-13 09:36:46 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2021-03-14 08:20:53 +0100 |
commit | c880d3e30405342a5ae6239cc77f69ed3ca6cc15 (patch) | |
tree | 66114edb519a8908326f08c82f04375e022aa6d5 /vcl | |
parent | ebe1f639cf65c20cee70aa55176bfb67e7b915f7 (diff) |
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@collabora.com>
Diffstat (limited to 'vcl')
-rw-r--r-- | vcl/source/app/svapp.cxx | 5 | ||||
-rw-r--r-- | vcl/source/control/prgsbar.cxx | 2 | ||||
-rw-r--r-- | vcl/source/window/dialog.cxx | 2 | ||||
-rw-r--r-- | vcl/source/window/menufloatingwindow.cxx | 2 | ||||
-rw-r--r-- | vcl/source/window/syswin.cxx | 2 |
5 files changed, 9 insertions, 4 deletions
diff --git a/vcl/source/app/svapp.cxx b/vcl/source/app/svapp.cxx index fb3cb8c56bcf..1f4f6e9e9de6 100644 --- a/vcl/source/app/svapp.cxx +++ b/vcl/source/app/svapp.cxx @@ -577,6 +577,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 e861d66bcb03..ef8d2867018a 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 92db0975c6c1..e18b9f18cd4b 100644 --- a/vcl/source/window/dialog.cxx +++ b/vcl/source/window/dialog.cxx @@ -1053,7 +1053,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 cfcb58b8f63e..dd1e2c6ea557 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 3ba8e96ce44e..64dd582f1277 100644 --- a/vcl/source/window/syswin.cxx +++ b/vcl/source/window/syswin.cxx @@ -1145,7 +1145,7 @@ void SystemWindow::ensureRepaint() Invalidate(); mbPaintComplete = false; - while (!mbPaintComplete) + while (!mbPaintComplete && !Application::IsQuit()) { Application::Yield(); } |