aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristian Kandeler <christian.kandeler@digia.com>2014-04-30 13:48:29 +0200
committerChristian Kandeler <christian.kandeler@digia.com>2014-04-30 14:48:29 +0200
commitda78b1a89a4445fe0fa76e549e5833bf0b793e41 (patch)
tree4d149943be17580884494e91c0d1be9b0292af17
parentc1e1176332ccddc01e86aa07a458710053c1e9fa (diff)
Fix crash on product disabling.
Task-number: QBS-561 Change-Id: Ia56280cb26241c7fb9debd0d4ce1349b041405a6 Reviewed-by: Joerg Bornemann <joerg.bornemann@digia.com>
-rw-r--r--src/lib/corelib/buildgraph/buildgraphloader.cpp2
-rw-r--r--tests/auto/blackbox/testdata/disable-product/project.qbs5
-rw-r--r--tests/auto/blackbox/tst_blackbox.cpp15
-rw-r--r--tests/auto/blackbox/tst_blackbox.h1
4 files changed, 22 insertions, 1 deletions
diff --git a/src/lib/corelib/buildgraph/buildgraphloader.cpp b/src/lib/corelib/buildgraph/buildgraphloader.cpp
index 0d27fd15a..df5e34e00 100644
--- a/src/lib/corelib/buildgraph/buildgraphloader.cpp
+++ b/src/lib/corelib/buildgraph/buildgraphloader.cpp
@@ -255,7 +255,7 @@ void BuildGraphLoader::trackProjectChanges(const SetupProjectParameters &paramet
if (restoredProduct->enabled) {
QBS_CHECK(restoredProduct->buildData);
foreach (Artifact * const a,
- ArtifactSet::fromNodeSet(newlyResolvedProduct->buildData->nodes)) {
+ ArtifactSet::fromNodeSet(restoredProduct->buildData->nodes)) {
const bool removeFromDisk = a->artifactType == Artifact::Generated;
newlyResolvedProduct->topLevelProject()->buildData->removeArtifact(a,
m_logger, removeFromDisk, true);
diff --git a/tests/auto/blackbox/testdata/disable-product/project.qbs b/tests/auto/blackbox/testdata/disable-product/project.qbs
new file mode 100644
index 000000000..3aa7afd50
--- /dev/null
+++ b/tests/auto/blackbox/testdata/disable-product/project.qbs
@@ -0,0 +1,5 @@
+import qbs
+
+Product {
+ // condition: false
+}
diff --git a/tests/auto/blackbox/tst_blackbox.cpp b/tests/auto/blackbox/tst_blackbox.cpp
index 50ec294f7..3ca70b7bd 100644
--- a/tests/auto/blackbox/tst_blackbox.cpp
+++ b/tests/auto/blackbox/tst_blackbox.cpp
@@ -1429,6 +1429,21 @@ void TestBlackbox::disabledProject()
QCOMPARE(runQbs(), 0);
}
+void TestBlackbox::disableProduct()
+{
+ QDir::setCurrent(testDataDir + "/disable-product");
+ QCOMPARE(runQbs(), 0);
+ waitForNewTimestamp();
+ QFile projectFile("project.qbs");
+ QVERIFY(projectFile.open(QIODevice::ReadWrite));
+ QByteArray content = projectFile.readAll();
+ content.replace("// condition: false", "condition: false");
+ projectFile.resize(0);
+ projectFile.write(content);
+ projectFile.close();
+ QCOMPARE(runQbs(), 0);
+}
+
void TestBlackbox::duplicateProductNames()
{
QDir::setCurrent(testDataDir + "/duplicateProductNames");
diff --git a/tests/auto/blackbox/tst_blackbox.h b/tests/auto/blackbox/tst_blackbox.h
index e0d6600eb..87008e266 100644
--- a/tests/auto/blackbox/tst_blackbox.h
+++ b/tests/auto/blackbox/tst_blackbox.h
@@ -108,6 +108,7 @@ private slots:
void dependenciesProperty();
void disabledProduct();
void disabledProject();
+ void disableProduct();
void duplicateProductNames();
void duplicateProductNames_data();
void dynamicLibs();