[Qt-creator] CMake: crash in cmakeproject.cpp

Peter Kümmel syntheticpp at gmx.net
Sun Feb 21 18:16:50 CET 2010


Here I have a crash in cmakeproject.cpp when opening 
a cmake configuration.

Reading a bit the history of cmakeproject.cpp, 
I tried attached patch, then it doesn't crash any more 
but it also doesn't work any more:
no project nor files in the project explorer.

Peter


-------------- next part --------------
diff --git a/src/plugins/cmakeprojectmanager/cmakeproject.cpp b/src/plugins/cmakeprojectmanager/cmakeproject.cpp
index 6bc709c..8dae1e6 100644
--- a/src/plugins/cmakeprojectmanager/cmakeproject.cpp
+++ b/src/plugins/cmakeprojectmanager/cmakeproject.cpp
@@ -487,8 +487,12 @@ bool CMakeProject::fromMap(const QVariantMap &map)
         if (copw.exec() != QDialog::Accepted)
             return false;
 
-        CMakeBuildConfiguration *bc =
-                static_cast<CMakeBuildConfiguration *>(t->buildConfigurations().at(0));
+        CMakeBuildConfiguration *bc = 0;
+        if (t->buildConfigurations().isEmpty()) {
+            bc = new CMakeBuildConfiguration(t);
+        } else {
+            bc = static_cast<CMakeBuildConfiguration *>(t->buildConfigurations().at(0));
+        }
         bc->setMsvcVersion(copw.msvcVersion());
         if (!copw.buildDirectory().isEmpty())
             bc->setBuildDirectory(copw.buildDirectory());


More information about the Qt-creator-old mailing list