diff options
author | Tobias Hunger <tobias.hunger@qt.io> | 2018-03-07 10:35:08 +0100 |
---|---|---|
committer | Tobias Hunger <tobias.hunger@qt.io> | 2018-03-07 14:35:15 +0000 |
commit | 6e419d642a2c1e9d6f5cc334bdd58305fd01b3e5 (patch) | |
tree | a04eb067a58183327c728ad1cc58a39718cd1a92 /src/plugins/qnx | |
parent | 23e48fe207d62b16ca5cef701536ce34f3c9681d (diff) | |
download | qt-creator-6e419d642a2c1e9d6f5cc334bdd58305fd01b3e5.tar.gz |
RunConfigurationFactories: Fix crash opening non-qmake based projects
Make sure the Qnx RCs only get triggered for qmake-based projects and defend
against broken set-ups using QTC_ASSERT.
Task-number: QTCREATORBUG-19755
Change-Id: If64b73de49b0199308f767151d68909dc8b1bc53
Reviewed-by: hjk <hjk@qt.io>
Diffstat (limited to 'src/plugins/qnx')
-rw-r--r-- | src/plugins/qnx/qnxrunconfigurationfactory.cpp | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/src/plugins/qnx/qnxrunconfigurationfactory.cpp b/src/plugins/qnx/qnxrunconfigurationfactory.cpp index 05112b36bb..5e2e2c8e46 100644 --- a/src/plugins/qnx/qnxrunconfigurationfactory.cpp +++ b/src/plugins/qnx/qnxrunconfigurationfactory.cpp @@ -32,6 +32,7 @@ #include <projectexplorer/kitinformation.h> #include <projectexplorer/target.h> #include <qmakeprojectmanager/qmakeproject.h> +#include <qmakeprojectmanager/qmakeprojectmanagerconstants.h> using namespace ProjectExplorer; @@ -41,14 +42,17 @@ namespace Internal { QnxRunConfigurationFactory::QnxRunConfigurationFactory(QObject *parent) : ProjectExplorer::IRunConfigurationFactory(parent) { - registerRunConfiguration<QnxRunConfiguration>(Constants::QNX_QNX_RUNCONFIGURATION_PREFIX); - setSupportedTargetDeviceTypes({Constants::QNX_QNX_OS_TYPE}); + registerRunConfiguration<QnxRunConfiguration>(Qnx::Constants::QNX_QNX_RUNCONFIGURATION_PREFIX); + setSupportedTargetDeviceTypes({Qnx::Constants::QNX_QNX_OS_TYPE}); + addSupportedProjectType(QmakeProjectManager::Constants::QMAKEPROJECT_ID); } QList<ProjectExplorer::BuildTargetInfo> QnxRunConfigurationFactory::availableBuildTargets(Target *parent, CreationMode mode) const { auto project = qobject_cast<QmakeProjectManager::QmakeProject *>(parent->project()); + QTC_ASSERT(project, return {}); + const QList<BuildTargetInfo> buildTargets = project->buildTargets(mode); return Utils::transform(buildTargets, [](BuildTargetInfo bti) { bti.displayName = tr("%1 on QNX Device").arg(QFileInfo(bti.targetName).completeBaseName()); @@ -60,6 +64,7 @@ bool QnxRunConfigurationFactory::canCreateHelper(ProjectExplorer::Target *parent const QString &buildTarget) const { auto project = qobject_cast<QmakeProjectManager::QmakeProject *>(parent->project()); + QTC_ASSERT(project, return false); return project->hasApplicationProFile(Utils::FileName::fromString(buildTarget)); } |