aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authordt <[email protected]>2009-10-21 13:45:49 +0200
committerdt <[email protected]>2009-10-21 13:45:49 +0200
commit1253c55d5609a96a8a0318ac102029f618578d08 (patch)
tree8ae7fd46a39285b8b8ee893afa65a7bbd05d7985
parent7d50aa29b809a2ba0e6b456255af3bbe5e275694 (diff)
Fix a race in CMakeProjectManager::createXml
-rw-r--r--src/plugins/cmakeprojectmanager/cmakeopenprojectwizard.cpp3
-rw-r--r--src/plugins/cmakeprojectmanager/cmakeprojectmanager.cpp12
-rw-r--r--src/plugins/cmakeprojectmanager/cmakeprojectmanager.h11
3 files changed, 13 insertions, 13 deletions
diff --git a/src/plugins/cmakeprojectmanager/cmakeopenprojectwizard.cpp b/src/plugins/cmakeprojectmanager/cmakeopenprojectwizard.cpp
index 0939a1c43f3..f9526756e79 100644
--- a/src/plugins/cmakeprojectmanager/cmakeopenprojectwizard.cpp
+++ b/src/plugins/cmakeprojectmanager/cmakeopenprojectwizard.cpp
@@ -435,9 +435,10 @@ void CMakeRunPage::runCMake()
m_output->clear();
if (m_cmakeWizard->cmakeManager()->isCMakeExecutableValid()) {
- m_cmakeProcess = cmakeManager->createXmlFile(arguments, m_cmakeWizard->sourceDirectory(), m_buildDirectory, env, generator);
+ m_cmakeProcess = new QProcess();
connect(m_cmakeProcess, SIGNAL(readyRead()), this, SLOT(cmakeReadyRead()));
connect(m_cmakeProcess, SIGNAL(finished(int)), this, SLOT(cmakeFinished()));
+ cmakeManager->createXmlFile(m_cmakeProcess, arguments, m_cmakeWizard->sourceDirectory(), m_buildDirectory, env, generator);
} else {
m_runCMake->setEnabled(true);
m_argumentsLineEdit->setEnabled(true);
diff --git a/src/plugins/cmakeprojectmanager/cmakeprojectmanager.cpp b/src/plugins/cmakeprojectmanager/cmakeprojectmanager.cpp
index fbab5af5d8f..d0b683c8b38 100644
--- a/src/plugins/cmakeprojectmanager/cmakeprojectmanager.cpp
+++ b/src/plugins/cmakeprojectmanager/cmakeprojectmanager.cpp
@@ -99,7 +99,7 @@ bool CMakeManager::hasCodeBlocksMsvcGenerator() const
// we probably want the process instead of this function
// cmakeproject then could even run the cmake process in the background, adding the files afterwards
// sounds like a plan
-QProcess *CMakeManager::createXmlFile(const QStringList &arguments, const QString &sourceDirectory, const QDir &buildDirectory, const ProjectExplorer::Environment &env, const QString &generator)
+void CMakeManager::createXmlFile(QProcess *proc, const QStringList &arguments, const QString &sourceDirectory, const QDir &buildDirectory, const ProjectExplorer::Environment &env, const QString &generator)
{
// We create a cbp file, only if we didn't find a cbp file in the base directory
// Yet that can still override cbp files in subdirectories
@@ -111,14 +111,12 @@ QProcess *CMakeManager::createXmlFile(const QStringList &arguments, const QStrin
// TODO we need to pass on the same paremeters as the cmakestep
QString buildDirectoryPath = buildDirectory.absolutePath();
buildDirectory.mkpath(buildDirectoryPath);
- QProcess *cmake = new QProcess;
- cmake->setWorkingDirectory(buildDirectoryPath);
- cmake->setProcessChannelMode(QProcess::MergedChannels);
- cmake->setEnvironment(env.toStringList());
+ proc->setWorkingDirectory(buildDirectoryPath);
+ proc->setProcessChannelMode(QProcess::MergedChannels);
+ proc->setEnvironment(env.toStringList());
const QString srcdir = buildDirectory.exists(QLatin1String("CMakeCache.txt")) ? QString(QLatin1Char('.')) : sourceDirectory;
- cmake->start(cmakeExecutable(), QStringList() << srcdir << arguments << generator);
- return cmake;
+ proc->start(cmakeExecutable(), QStringList() << srcdir << arguments << generator);
}
QString CMakeManager::findCbpFile(const QDir &directory)
diff --git a/src/plugins/cmakeprojectmanager/cmakeprojectmanager.h b/src/plugins/cmakeprojectmanager/cmakeprojectmanager.h
index a33055235ab..2c8a3ee3fc0 100644
--- a/src/plugins/cmakeprojectmanager/cmakeprojectmanager.h
+++ b/src/plugins/cmakeprojectmanager/cmakeprojectmanager.h
@@ -63,11 +63,12 @@ public:
void setCMakeExecutable(const QString &executable);
- QProcess* createXmlFile(const QStringList &arguments,
- const QString &sourceDirectory,
- const QDir &buildDirectory,
- const ProjectExplorer::Environment &env,
- const QString &generator);
+ void createXmlFile(QProcess *process,
+ const QStringList &arguments,
+ const QString &sourceDirectory,
+ const QDir &buildDirectory,
+ const ProjectExplorer::Environment &env,
+ const QString &generator);
bool hasCodeBlocksMsvcGenerator() const;
static QString findCbpFile(const QDir &);