Debugger: Avoid some uses of RunControl::runConfiguration()

Change-Id: I1dcf5b96e6c23e369217f38a440305abb51dcd25
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
This commit is contained in:
hjk
2019-03-13 18:28:29 +01:00
parent 7b15dc35eb
commit 7a4752bde5
2 changed files with 6 additions and 7 deletions

View File

@@ -889,8 +889,6 @@ DebuggerRunTool::DebuggerRunTool(RunControl *runControl, AllowTerminal allowTerm
d->runId = QString::number(++toolRunCount);
RunConfiguration *runConfig = runControl->runConfiguration();
runControl->setIcon(ProjectExplorer::Icons::DEBUG_START_SMALL_TOOLBAR);
runControl->setPromptToStop([](bool *optionalPrompt) {
return RunControl::showPromptToStopDialog(
@@ -902,8 +900,7 @@ DebuggerRunTool::DebuggerRunTool(RunControl *runControl, AllowTerminal allowTerm
QString(), QString(), optionalPrompt);
});
if (runConfig)
m_runParameters.displayName = runConfig->displayName();
m_runParameters.displayName = runControl->displayName();
if (auto symbolsAspect = runControl->aspect<SymbolFileAspect>())
m_runParameters.symbolFile = symbolsAspect->value();
@@ -938,8 +935,7 @@ DebuggerRunTool::DebuggerRunTool(RunControl *runControl, AllowTerminal allowTerm
if (!envBinary.isEmpty())
m_runParameters.debugger.executable = QString::fromLocal8Bit(envBinary);
Project *project = runConfig ? runConfig->target()->project() : nullptr;
if (project) {
if (Project *project = runControl->project()) {
m_runParameters.projectSourceDirectory = project->projectDirectory();
m_runParameters.projectSourceFiles = project->files(Project::SourceFiles);
}
@@ -959,6 +955,7 @@ DebuggerRunTool::DebuggerRunTool(RunControl *runControl, AllowTerminal allowTerm
m_runParameters.validationErrors.append(t.description);
}
RunConfiguration *runConfig = runControl->runConfiguration();
if (runConfig && runConfig->property("supportsDebugger").toBool()) {
const QString mainScript = runConfig->property("mainScript").toString();
const QString interpreter = runConfig->property("interpreter").toString();

View File

@@ -297,6 +297,7 @@ public:
QPointer<RunConfiguration> runConfiguration; // Not owned. Avoid use.
Kit *kit = nullptr; // Not owned.
QPointer<Target> target; // Not owned.
QPointer<Project> project; // Not owned.
QPointer<Utils::OutputFormatter> outputFormatter = nullptr;
std::function<bool(bool*)> promptToStop;
std::vector<RunWorkerFactory> m_factories;
@@ -339,6 +340,7 @@ void RunControl::setTarget(Target *target)
QTC_CHECK(!d->target);
d->target = target;
setKit(target->kit());
d->project = target->project();
}
void RunControl::setKit(Kit *kit)
@@ -838,7 +840,7 @@ Target *RunControl::target() const
Project *RunControl::project() const
{
return d->target->project();
return d->project;
}
Kit *RunControl::kit() const