diff options
author | Alessandro Portale <alessandro.portale@qt.io> | 2024-05-15 20:20:35 +0200 |
---|---|---|
committer | Alessandro Portale <alessandro.portale@qt.io> | 2024-05-15 18:52:46 +0000 |
commit | 15446c9e3f069c883c5348a520254f04b707dd4a (patch) | |
tree | 9c647eb6f4ca1752e34de6fec5ff564c1adf03e1 | |
parent | 2c41ce2f0a99a1eff03eda9634878b74b9252419 (diff) |
Android: Don't crash when dis- and reconnecting phone via USB
When ADB signals a change about the list of connected devices, the whole build/run steps tree gets deleted and recreated.
The AndroidBuildApkStep is a part of that tree and starts one or more
"keytool" processes on creation/init. They were started with their own
event loop. Those synthetic event loops caused a change in order of
deletion which led to crashes with obscure backtraces.
This change removes the event loop creation from "keytool" calls. The
crash is avoided.
The calls take ~0.5 seconds. The short UI freeze should be an acceptable
hotfix trade-off for a crash in QtC13. If 0.5 seconds freeze seem too
much, a better fix could be done in QtC 14.
Fixes: QTCREATORBUG-30645
Fixes: QTCREATORBUG-30770
Change-Id: I8842dc87023142ae75572bf255c7f1ec808d9bab
Reviewed-by: Jarek Kobus <jaroslaw.kobus@qt.io>
-rw-r--r-- | src/plugins/android/androidbuildapkstep.cpp | 2 | ||||
-rw-r--r-- | src/plugins/android/androidcreatekeystorecertificate.cpp | 2 | ||||
-rw-r--r-- | src/plugins/android/androidmanager.cpp | 6 |
3 files changed, 5 insertions, 5 deletions
diff --git a/src/plugins/android/androidbuildapkstep.cpp b/src/plugins/android/androidbuildapkstep.cpp index c57d008705..c73cc916f7 100644 --- a/src/plugins/android/androidbuildapkstep.cpp +++ b/src/plugins/android/androidbuildapkstep.cpp @@ -1002,7 +1002,7 @@ QAbstractItemModel *AndroidBuildApkStep::keystoreCertificates() Process keytoolProc; keytoolProc.setCommand({androidConfig().keytoolPath(), params}); using namespace std::chrono_literals; - keytoolProc.runBlocking(30s, EventLoopMode::On); + keytoolProc.runBlocking(30s); if (keytoolProc.result() > ProcessResult::FinishedWithError) QMessageBox::critical(nullptr, Tr::tr("Error"), Tr::tr("Failed to run keytool.")); else diff --git a/src/plugins/android/androidcreatekeystorecertificate.cpp b/src/plugins/android/androidcreatekeystorecertificate.cpp index 7a6fd7cf59..f0b5f7c00c 100644 --- a/src/plugins/android/androidcreatekeystorecertificate.cpp +++ b/src/plugins/android/androidcreatekeystorecertificate.cpp @@ -275,7 +275,7 @@ void AndroidCreateKeystoreCertificate::buttonBoxAccepted() Process genKeyCertProc; genKeyCertProc.setCommand(command); using namespace std::chrono_literals; - genKeyCertProc.runBlocking(15s, EventLoopMode::On); + genKeyCertProc.runBlocking(15s); if (genKeyCertProc.result() != ProcessResult::FinishedWithSuccess) { QMessageBox::critical(this, Tr::tr("Error"), diff --git a/src/plugins/android/androidmanager.cpp b/src/plugins/android/androidmanager.cpp index bd230c76af..d2d4d1c789 100644 --- a/src/plugins/android/androidmanager.cpp +++ b/src/plugins/android/androidmanager.cpp @@ -614,7 +614,7 @@ bool checkKeystorePassword(const FilePath &keystorePath, const QString &keystore "--storepass", keystorePasswd}); Process proc; proc.setCommand(cmd); - proc.runBlocking(10s, EventLoopMode::On); + proc.runBlocking(10s); return proc.result() == ProcessResult::FinishedWithSuccess; } @@ -631,7 +631,7 @@ bool checkCertificatePassword(const FilePath &keystorePath, const QString &keyst Process proc; proc.setCommand({androidConfig().keytoolPath(), arguments}); - proc.runBlocking(10s, EventLoopMode::On); + proc.runBlocking(10s); return proc.result() == ProcessResult::FinishedWithSuccess; } @@ -644,7 +644,7 @@ bool checkCertificateExists(const FilePath &keystorePath, const QString &keystor Process proc; proc.setCommand({androidConfig().keytoolPath(), arguments}); - proc.runBlocking(10s, EventLoopMode::On); + proc.runBlocking(10s); return proc.result() == ProcessResult::FinishedWithSuccess; } |