forked from qt-creator/qt-creator
CMake: Fix crashes when last target is removed from a project
Task-number: QTCREATORBUG-19112 Change-Id: I17893c3e15e9cabc09bf5ebb6746a5d76d9cc0bd Reviewed-by: Eike Ziller <eike.ziller@qt.io>
This commit is contained in:
@@ -140,6 +140,9 @@ CMakeProject::CMakeProject(const FileName &fileName) : Project(Constants::CMAKEM
|
||||
connect(this, &Project::activeTargetChanged, this, [this]() {
|
||||
CMakeBuildConfiguration *bc = activeBc(this);
|
||||
|
||||
if (!bc)
|
||||
return;
|
||||
|
||||
// Target has switched, so the kit has changed, too.
|
||||
// * run cmake with configuration arguments if the reader needs to be switched
|
||||
// * run cmake without configuration arguments if the reader stays
|
||||
@@ -153,6 +156,9 @@ CMakeProject::CMakeProject(const FileName &fileName) : Project(Constants::CMAKEM
|
||||
subscribeSignal(&Target::activeBuildConfigurationChanged, this, [this]() {
|
||||
CMakeBuildConfiguration *bc = activeBc(this);
|
||||
|
||||
if (!bc)
|
||||
return;
|
||||
|
||||
// Build configuration has switched:
|
||||
// * Error out if the reader updates, can not happen since all BCs share a target/kit.
|
||||
// * run cmake without configuration arguments if the reader stays
|
||||
|
||||
Reference in New Issue
Block a user