forked from qt-creator/qt-creator
ProjectExplorer: Do not run the build output parser test from a thread
Tasks must only be created in the main thread. Change-Id: I7d0e6f850bec3eb1d700ffa8fdba0c2e253d47aa Reviewed-by: Jarek Kobus <jaroslaw.kobus@qt.io>
This commit is contained in:
@@ -32,9 +32,6 @@
|
|||||||
#include "projectexplorerconstants.h"
|
#include "projectexplorerconstants.h"
|
||||||
#include "taskhub.h"
|
#include "taskhub.h"
|
||||||
|
|
||||||
#include <coreplugin/progressmanager/progressmanager.h>
|
|
||||||
#include <utils/runextensions.h>
|
|
||||||
|
|
||||||
#include <QButtonGroup>
|
#include <QButtonGroup>
|
||||||
#include <QCheckBox>
|
#include <QCheckBox>
|
||||||
#include <QDialogButtonBox>
|
#include <QDialogButtonBox>
|
||||||
@@ -137,21 +134,6 @@ ParseIssuesDialog::~ParseIssuesDialog()
|
|||||||
delete d;
|
delete d;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void parse(QFutureInterface<void> &future, const QString &output,
|
|
||||||
const std::unique_ptr<Utils::OutputFormatter> &parser, bool isStderr)
|
|
||||||
{
|
|
||||||
const QStringList lines = output.split('\n');
|
|
||||||
future.setProgressRange(0, lines.count());
|
|
||||||
const Utils::OutputFormat format = isStderr ? Utils::StdErrFormat : Utils::StdOutFormat;
|
|
||||||
for (const QString &line : lines) {
|
|
||||||
parser->appendMessage(line + '\n', format);
|
|
||||||
future.setProgressValue(future.progressValue() + 1);
|
|
||||||
if (future.isCanceled())
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
parser->flush();
|
|
||||||
}
|
|
||||||
|
|
||||||
void ParseIssuesDialog::accept()
|
void ParseIssuesDialog::accept()
|
||||||
{
|
{
|
||||||
const QList<Utils::OutputLineParser *> lineParsers =
|
const QList<Utils::OutputLineParser *> lineParsers =
|
||||||
@@ -161,14 +143,16 @@ void ParseIssuesDialog::accept()
|
|||||||
"not provide an output parser."));
|
"not provide an output parser."));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
std::unique_ptr<Utils::OutputFormatter> parser(new Utils::OutputFormatter);
|
Utils::OutputFormatter parser;
|
||||||
parser->setLineParsers(lineParsers);
|
parser.setLineParsers(lineParsers);
|
||||||
if (d->clearTasksCheckBox.isChecked())
|
if (d->clearTasksCheckBox.isChecked())
|
||||||
TaskHub::clearTasks();
|
TaskHub::clearTasks();
|
||||||
const QFuture<void> f = Utils::runAsync(&parse, d->compileOutputEdit.toPlainText(),
|
const QStringList lines = d->compileOutputEdit.toPlainText().split('\n');
|
||||||
std::move(parser), d->stderrCheckBox.isChecked());
|
const Utils::OutputFormat format = d->stderrCheckBox.isChecked()
|
||||||
Core::ProgressManager::addTask(f, tr("Parsing build output"),
|
? Utils::StdErrFormat : Utils::StdOutFormat;
|
||||||
"ProgressExplorer.ParseExternalBuildOutput");
|
for (const QString &line : lines)
|
||||||
|
parser.appendMessage(line + '\n', format);
|
||||||
|
parser.flush();
|
||||||
QDialog::accept();
|
QDialog::accept();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user