forked from qt-creator/qt-creator
Qbs: Fix crash when renaming files
Fix a crash when using file nodes to change the project. The methods used to take const references, with the data living in the nodes of the project tree. Since the methods change the project tree and thus cause the tree to be rebuilt, the original data may get lost. So copy the data instead. All the qbs::*Data classes are using shared data, so the overhead is not too big. Task-number: QTCREATORBUG-18440 Change-Id: I45ca5403a04e17790416dfe15b836f12c732e824 Reviewed-by: Eike Ziller <eike.ziller@qt.io> Reviewed-by: Tim Jenssen <tim.jenssen@qt.io> Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
This commit is contained in:
committed by
Tobias Hunger
parent
6ab1da8b78
commit
56db0df2e6
@@ -237,8 +237,8 @@ bool QbsProject::ensureWriteableQbsFile(const QString &file)
|
||||
}
|
||||
|
||||
bool QbsProject::addFilesToProduct(const QStringList &filePaths,
|
||||
const qbs::ProductData &productData,
|
||||
const qbs::GroupData &groupData, QStringList *notAdded)
|
||||
const qbs::ProductData productData,
|
||||
const qbs::GroupData groupData, QStringList *notAdded)
|
||||
{
|
||||
QTC_ASSERT(m_qbsProject.isValid(), return false);
|
||||
QStringList allPaths = groupData.allFilePaths();
|
||||
@@ -262,8 +262,8 @@ bool QbsProject::addFilesToProduct(const QStringList &filePaths,
|
||||
}
|
||||
|
||||
bool QbsProject::removeFilesFromProduct(const QStringList &filePaths,
|
||||
const qbs::ProductData &productData,
|
||||
const qbs::GroupData &groupData,
|
||||
const qbs::ProductData productData,
|
||||
const qbs::GroupData groupData,
|
||||
QStringList *notRemoved)
|
||||
{
|
||||
QTC_ASSERT(m_qbsProject.isValid(), return false);
|
||||
@@ -290,8 +290,8 @@ bool QbsProject::removeFilesFromProduct(const QStringList &filePaths,
|
||||
}
|
||||
|
||||
bool QbsProject::renameFileInProduct(const QString &oldPath, const QString &newPath,
|
||||
const qbs::ProductData &productData,
|
||||
const qbs::GroupData &groupData)
|
||||
const qbs::ProductData productData,
|
||||
const qbs::GroupData groupData)
|
||||
{
|
||||
if (newPath.isEmpty())
|
||||
return false;
|
||||
|
||||
Reference in New Issue
Block a user