diff options
author | Christian Kandeler <christian.kandeler@digia.com> | 2014-07-30 16:19:22 +0200 |
---|---|---|
committer | Christian Kandeler <christian.kandeler@digia.com> | 2014-07-30 16:57:02 +0200 |
commit | 59aed7c423ab1ff8e19d34736619cb128cc8b49a (patch) | |
tree | 013307f4243703e342bc89fcdc62ad4647cd5a9f /src/lib | |
parent | c598241085cd191c3914a4b614f219e7a9a55bbf (diff) |
Invalidate project after certain unsuccessful re-resolving attempts.
Namely, if the build data has been mangled by the re-resolving attempt.
Change-Id: Ibe020a6bda38a335f95e2d2cef4f37fac3199a7d
Reviewed-by: Joerg Bornemann <joerg.bornemann@digia.com>
Diffstat (limited to 'src/lib')
-rw-r--r-- | src/lib/corelib/api/jobs.cpp | 6 | ||||
-rw-r--r-- | src/lib/corelib/api/project.cpp | 7 |
2 files changed, 10 insertions, 3 deletions
diff --git a/src/lib/corelib/api/jobs.cpp b/src/lib/corelib/api/jobs.cpp index 6b8cf702e..00269d947 100644 --- a/src/lib/corelib/api/jobs.cpp +++ b/src/lib/corelib/api/jobs.cpp @@ -252,8 +252,12 @@ void SetupProjectJob::finish() // The invariant is that there must always be at most one valid Project object // for the same build directory, so that exclusive ownership of the build graph lock // is ensured. - if (m_existingProject.isValid() && !error().hasError()) + // We also need to invalidate the project if an error has occurred after the build data was + // already transferred. + if (m_existingProject.isValid() + && (!error().hasError() || !m_existingProject.d->internalProject->buildData)) { m_existingProject.d->internalProject.clear(); + } } /*! diff --git a/src/lib/corelib/api/project.cpp b/src/lib/corelib/api/project.cpp index 3e5ea76d9..93daf433f 100644 --- a/src/lib/corelib/api/project.cpp +++ b/src/lib/corelib/api/project.cpp @@ -717,8 +717,11 @@ Project &Project::operator=(const Project &other) * track the results of the operation. * If the function is called on a valid \c Project object, the build graph will not be loaded * from a file, but will be taken from the existing project. In that case, if resolving - * finishes successfully, the existing project will be invalidated. If resolving fails, the - * existing \c Project object stays as it is. + * finishes successfully, the existing project will be invalidated. If resolving fails, qbs will + * try to keep the existing project valid. However, under certain circumstances, resolving the new + * project will fail at a time where existing project data has already been touched, in which case + * the existing project has to be invalidated (this could be avoided, but it would hurt performance). + * So after an unsuccessful re-resolve job, the existing project may or may not be valid anymore. * \note The qbs plugins will only be loaded once. As a result, the value of * \c parameters.pluginPaths will only have an effect the first time this function is called. * Similarly, the value of \c parameters.searchPaths will not have an effect if |