aboutsummaryrefslogtreecommitdiffstats
path: root/src/lib/corelib/api/internaljobs.cpp
diff options
context:
space:
mode:
authorChristian Kandeler <christian.kandeler@theqtcompany.com>2016-06-07 13:38:16 +0200
committerChristian Kandeler <christian.kandeler@theqtcompany.com>2016-06-07 12:42:46 +0000
commit9739da5986d814ad6927ac09217a8cc593a29b1a (patch)
treef2f37989b82b36212920e63161cb064a36c02545 /src/lib/corelib/api/internaljobs.cpp
parentecc26c0a76b5581d8d44c9499e5bff0bf067d2b1 (diff)
Fix potential crash in project setup.
If we - held an existing project open (in an IDE) and - changed its build directory and - a second qbs instance also held a project open there and - that second qbs instance used the same profile then we would correctly detect that a competing build graph was already present, but afterwards we would erroneously delete the build graph lock object of the existing project, leading to a double-delete later when the project itself was deleted. Task-number: QTCREATORBUG-16376 Change-Id: Ie6c621f1dab5cc7b7ff97bf6c25d62609dc9eb35 Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
Diffstat (limited to 'src/lib/corelib/api/internaljobs.cpp')
-rw-r--r--src/lib/corelib/api/internaljobs.cpp5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/lib/corelib/api/internaljobs.cpp b/src/lib/corelib/api/internaljobs.cpp
index 2c0693566..87ae69617 100644
--- a/src/lib/corelib/api/internaljobs.cpp
+++ b/src/lib/corelib/api/internaljobs.cpp
@@ -226,6 +226,7 @@ TopLevelProjectPtr InternalSetupProjectJob::project() const
void InternalSetupProjectJob::start()
{
+ const TopLevelProjectConstPtr existingProject = m_existingProject;
BuildGraphLocker *bgLocker = m_existingProject ? m_existingProject->bgLocker : 0;
try {
const ErrorInfo err = m_parameters.expandBuildConfiguration();
@@ -249,7 +250,9 @@ void InternalSetupProjectJob::start()
} catch (const ErrorInfo &error) {
m_newProject.clear();
setError(error);
- if (!m_existingProject)
+
+ // Delete the build graph locker if and only if we allocated it here.
+ if (!existingProject)
delete bgLocker;
}
emit finished(this);