summaryrefslogtreecommitdiff
path: root/src/plugins/beautifier
diff options
context:
space:
mode:
authorTobias Hunger <tobias.hunger@qt.io>2016-05-26 12:12:01 +0200
committerTobias Hunger <tobias.hunger@qt.io>2016-05-26 11:50:03 +0000
commit5d3823ac4727fb426915b468a031346e5f9ab929 (patch)
tree5ce95d25b8028fa82174d0a0f41bdc3b53a66e75 /src/plugins/beautifier
parent179153829a7bf2d72ffa290b2e1da4bdb58eea90 (diff)
downloadqt-creator-5d3823ac4727fb426915b468a031346e5f9ab929.tar.gz
Use SynchronousProcess::runBlocking
Use SynchronousProcess::runBlocking in favor of SychronousProcess::run. This avoid nested event loops which can produce really strange crashes if not use carefully. This patch only converts those processes that have a timeout of less than 5 seconds or use the default timeout. Change-Id: I9de8899dcc946af7049ea357a91972996c0256a1 Reviewed-by: Vikas Pachdha <vikas.pachdha@theqtcompany.com> Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
Diffstat (limited to 'src/plugins/beautifier')
-rw-r--r--src/plugins/beautifier/artisticstyle/artisticstylesettings.cpp4
-rw-r--r--src/plugins/beautifier/beautifierplugin.cpp2
-rw-r--r--src/plugins/beautifier/uncrustify/uncrustifysettings.cpp2
3 files changed, 4 insertions, 4 deletions
diff --git a/src/plugins/beautifier/artisticstyle/artisticstylesettings.cpp b/src/plugins/beautifier/artisticstyle/artisticstylesettings.cpp
index ea7ea11431..52a546860c 100644
--- a/src/plugins/beautifier/artisticstyle/artisticstylesettings.cpp
+++ b/src/plugins/beautifier/artisticstyle/artisticstylesettings.cpp
@@ -80,7 +80,7 @@ static int updateVersionHelper(const QString &command)
{
Utils::SynchronousProcess process;
Utils::SynchronousProcessResponse response
- = process.run(command, QStringList() << QLatin1String("--version"));
+ = process.runBlocking(command, QStringList() << QLatin1String("--version"));
if (response.result != Utils::SynchronousProcessResponse::Finished)
return 0;
@@ -157,7 +157,7 @@ void ArtisticStyleSettings::createDocumentationFile() const
Utils::SynchronousProcess process;
process.setTimeoutS(2);
Utils::SynchronousProcessResponse response
- = process.run(command(), QStringList() << QLatin1String("-h"));
+ = process.runBlocking(command(), QStringList() << QLatin1String("-h"));
if (response.result != Utils::SynchronousProcessResponse::Finished)
return;
diff --git a/src/plugins/beautifier/beautifierplugin.cpp b/src/plugins/beautifier/beautifierplugin.cpp
index 39798ac202..d3f0bbacb9 100644
--- a/src/plugins/beautifier/beautifierplugin.cpp
+++ b/src/plugins/beautifier/beautifierplugin.cpp
@@ -99,7 +99,7 @@ FormatTask format(FormatTask task)
options.replaceInStrings(QLatin1String("%file"), sourceFile.fileName());
Utils::SynchronousProcess process;
process.setTimeoutS(5);
- Utils::SynchronousProcessResponse response = process.run(executable, options);
+ Utils::SynchronousProcessResponse response = process.runBlocking(executable, options);
if (response.result != Utils::SynchronousProcessResponse::Finished) {
task.error = QObject::tr("Failed to format: %1.").arg(response.exitMessage(executable, 5));
return task;
diff --git a/src/plugins/beautifier/uncrustify/uncrustifysettings.cpp b/src/plugins/beautifier/uncrustify/uncrustifysettings.cpp
index bdbb34c211..804bec3205 100644
--- a/src/plugins/beautifier/uncrustify/uncrustifysettings.cpp
+++ b/src/plugins/beautifier/uncrustify/uncrustifysettings.cpp
@@ -129,7 +129,7 @@ void UncrustifySettings::createDocumentationFile() const
Utils::SynchronousProcess process;
process.setTimeoutS(2);
Utils::SynchronousProcessResponse response
- = process.run(command(), QStringList() << QLatin1String("--show-config"));
+ = process.runBlocking(command(), QStringList() << QLatin1String("--show-config"));
if (response.result != Utils::SynchronousProcessResponse::Finished)
return;