make QMakeProject's copy c'tor actually behave like one
authorOswald Buddenhagen <oswald.buddenhagen@nokia.com>
Fri, 3 Feb 2012 17:34:56 +0000 (18:34 +0100)
committerQt by Nokia <qt-info@nokia.com>
Tue, 6 Mar 2012 05:34:47 +0000 (06:34 +0100)
instead of initializing base_vars with the original's vars, initialize
vars itself. this has two consequences:
- there is no need to call read(0) to initialize vars
- one cannot usefully call the complex read() anymore, as that would
  re-initialize vars from base_vars

this is much closer to an actual copy than the previous "seeding with
existing project".

Change-Id: Ib007bc5b779aedb680a27329aa578f7c604a4308
Reviewed-by: Joerg Bornemann <joerg.bornemann@nokia.com>
Reviewed-by: Marius Storm-Olsen <marius.storm-olsen@nokia.com>
qmake/generators/mac/pbuilder_pbx.cpp
qmake/project.cpp

index 70efff0..770a1ad 100644 (file)
@@ -178,7 +178,6 @@ ProjectBuilderMakefileGenerator::writeSubDirs(QTextStream &t)
                     }
                     if(tmp_proj.first("TEMPLATE") == "subdirs") {
                         QMakeProject *pp = new QMakeProject(&tmp_proj);
-                        pp->read(0);
                         pb_subdirs += new ProjectBuilderSubDirs(pp, dir);
                     } else if(tmp_proj.first("TEMPLATE") == "app" || tmp_proj.first("TEMPLATE") == "lib") {
                         QString pbxproj = qmake_getpwd() + Option::dir_sep + tmp_proj.first("TARGET") + projectSuffix();
index ecd31d5..7f73b1f 100644 (file)
@@ -627,10 +627,11 @@ QMakeProject::init(QMakeProperty *p)
     reset();
 }
 
-QMakeProject::QMakeProject(QMakeProject *p, const QHash<QString, QStringList> *vars)
+// Duplicate project. It is *not* allowed to call the complex read() functions on the copy.
+QMakeProject::QMakeProject(QMakeProject *p, const QHash<QString, QStringList> *_vars)
 {
     init(p->properties());
-    base_vars = vars ? *vars : p->variables();
+    vars = _vars ? *_vars : p->variables();
     for(QHash<QString, FunctionBlock*>::iterator it = p->replaceFunctions.begin(); it != p->replaceFunctions.end(); ++it) {
         it.value()->ref();
         replaceFunctions.insert(it.key(), it.value());