aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEike Ziller <eike.ziller@qt.io>2023-03-13 09:50:15 +0100
committerEike Ziller <eike.ziller@qt.io>2023-03-13 09:13:02 +0000
commit425262ce7e0c18ff3d48283a39be2e1379194cce (patch)
treea38bfa07fe6e8500a65fa01441e6adba5d6c20e7
parent05d9742a96abafbd07007319cc35167d8975b070 (diff)
iOS: Fix freeze when stopping application
The target of the connection determines in which thread the slot is executed, and in these cases the slot needs to be executed in the logging thread. But the LogTailFiles object is created and stays on the main thread. So, the slot that was supposed to stop the event loop in the logging thread was blocked from being executed when IosToolHanderPrivate waited for the canceled threads to finish with futureSynchronizer.waitForFinished(). Use the event loop as the "target" of the connections. Amends 33e8251edffcf96a9b4cb206ff5a7c317d25f75d Change-Id: Ie78fcb33b88c1fe7a138fac790fd4f3b7dd9bad9 Reviewed-by: Jarek Kobus <jaroslaw.kobus@qt.io>
-rw-r--r--src/plugins/ios/iostoolhandler.cpp8
1 files changed, 3 insertions, 5 deletions
diff --git a/src/plugins/ios/iostoolhandler.cpp b/src/plugins/ios/iostoolhandler.cpp
index 0cf9fed5ce..0331ba2cca 100644
--- a/src/plugins/ios/iostoolhandler.cpp
+++ b/src/plugins/ios/iostoolhandler.cpp
@@ -72,14 +72,12 @@ public:
// The future is canceled when app on simulator is stoped.
QEventLoop loop;
QFutureWatcher<void> watcher;
- connect(&watcher, &QFutureWatcher<void>::canceled, this, [&] {
- loop.quit();
- });
+ connect(&watcher, &QFutureWatcher<void>::canceled, &loop, [&] { loop.quit(); });
watcher.setFuture(fi.future());
// Process to print the console output while app is running.
- auto logProcess = [this, fi](QProcess *tailProcess, std::shared_ptr<QTemporaryFile> file) {
- QObject::connect(tailProcess, &QProcess::readyReadStandardOutput, this, [=] {
+ auto logProcess = [&](QProcess *tailProcess, std::shared_ptr<QTemporaryFile> file) {
+ QObject::connect(tailProcess, &QProcess::readyReadStandardOutput, &loop, [=] {
if (!fi.isCanceled())
emit logMessage(QString::fromLocal8Bit(tailProcess->readAll()));
});