summaryrefslogtreecommitdiff
path: root/vcl/qt5
diff options
context:
space:
mode:
authorJan-Marek Glogowski <glogow@fbihome.de>2021-11-17 10:29:24 +0100
committerJan-Marek Glogowski <glogow@fbihome.de>2022-01-21 12:42:20 +0100
commita9bb94e28a6757719a2e833c9d3ca17b3205283b (patch)
tree23e68d198a5fc609bfbb5567b0be90f2f4638935 /vcl/qt5
parent3eb6d764b3023500f2299d36bf1860bc8e67db9f (diff)
VCL fix shutdown when run via system loop
Adds DoQuit and SAL_USE_SYSTEM_LOOP to complement DoExecute. Makes it easier to switch between a LO with and without nested event processing. Unfortunatly the recovery dialogs run outside of Application::Execute(), so this currently also disables recovery handling. Follow-up (and no more Emscripten-specific) change to commit 93133585b5b52e38defc3162eeb1e7704dceafcb ("WASM optionally run any app via system loop"). Change-Id: I1b622065d7fa0c5ad03a7c7daaf8241dcc3f09a3 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/128717 Tested-by: Jenkins Reviewed-by: Jan-Marek Glogowski <glogow@fbihome.de>
Diffstat (limited to 'vcl/qt5')
-rw-r--r--vcl/qt5/QtInstance.cxx19
-rw-r--r--vcl/qt5/QtTimer.cxx11
2 files changed, 18 insertions, 12 deletions
diff --git a/vcl/qt5/QtInstance.cxx b/vcl/qt5/QtInstance.cxx
index a03b71e46bd2..a52f6529c3bc 100644
--- a/vcl/qt5/QtInstance.cxx
+++ b/vcl/qt5/QtInstance.cxx
@@ -259,6 +259,8 @@ QtInstance::QtInstance(std::unique_ptr<QApplication>& pQApp, bool bUseCairo)
#ifndef EMSCRIPTEN
m_bSupportsOpenGL = true;
+#else
+ ImplGetSVData()->maAppData.m_bUseSystemLoop = true;
#endif
}
@@ -726,13 +728,16 @@ std::unique_ptr<QApplication> QtInstance::CreateQApplication(int& nArgc, char**
bool QtInstance::DoExecute(int& nExitCode)
{
-#ifdef EMSCRIPTEN
- nExitCode = m_pQApplication->exec();
- return true;
-#else
- (void)nExitCode;
- return false;
-#endif
+ const bool bIsOnSystemEventLoop = Application::IsOnSystemEventLoop();
+ if (bIsOnSystemEventLoop)
+ nExitCode = QApplication::exec();
+ return bIsOnSystemEventLoop;
+}
+
+void QtInstance::DoQuit()
+{
+ if (Application::IsOnSystemEventLoop())
+ QApplication::quit();
}
extern "C" {
diff --git a/vcl/qt5/QtTimer.cxx b/vcl/qt5/QtTimer.cxx
index 6568ca8ac1b8..1a34213977dc 100644
--- a/vcl/qt5/QtTimer.cxx
+++ b/vcl/qt5/QtTimer.cxx
@@ -42,11 +42,12 @@ QtTimer::QtTimer()
void QtTimer::timeoutActivated()
{
SolarMutexGuard aGuard;
-#ifdef EMSCRIPTEN
- const ImplSVData* pSVData = ImplGetSVData();
- assert(pSVData->mpDefInst);
- static_cast<QtInstance*>(pSVData->mpDefInst)->DispatchUserEvents(true);
-#endif
+ if (Application::IsOnSystemEventLoop())
+ {
+ const ImplSVData* pSVData = ImplGetSVData();
+ assert(pSVData && pSVData->mpDefInst);
+ static_cast<QtInstance*>(pSVData->mpDefInst)->DispatchUserEvents(true);
+ }
CallCallback();
}