forked from qt-creator/qt-creator
FilePath: Return QString copy from toString()
Returning a const reference is different from our usual coding style, and can lead to crashes when assigning to a const reference, like const QString &path = filePath.pathAppended("foo").toString(); Make it behave like our other API. Change-Id: Iab1cf1a944be405227b135c12029f58869893911 Reviewed-by: hjk <hjk@qt.io> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
This commit is contained in:
@@ -727,7 +727,7 @@ FilePath FilePath::fromUrl(const QUrl &url)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// \returns a QString for passing on to QString based APIs
|
/// \returns a QString for passing on to QString based APIs
|
||||||
const QString &FilePath::toString() const
|
QString FilePath::toString() const
|
||||||
{
|
{
|
||||||
return m_data;
|
return m_data;
|
||||||
}
|
}
|
||||||
|
@@ -78,7 +78,7 @@ public:
|
|||||||
static FilePath fromUtf8(const char *filepath, int filepathSize = -1);
|
static FilePath fromUtf8(const char *filepath, int filepathSize = -1);
|
||||||
static FilePath fromVariant(const QVariant &variant);
|
static FilePath fromVariant(const QVariant &variant);
|
||||||
|
|
||||||
const QString &toString() const;
|
QString toString() const;
|
||||||
QFileInfo toFileInfo() const;
|
QFileInfo toFileInfo() const;
|
||||||
QVariant toVariant() const;
|
QVariant toVariant() const;
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user