forked from qt-creator/qt-creator
Utils: Do not save file upon PersistentSettingsWriter destruction
The m_savedData member is set on two occasions: Once directly after reading the same file that is going to be written, and once directly after a successful file save. In neither case do we have to write it out again. Fixes: QTCREATORBUG-25921 Change-Id: Ie369e280f4189aefb6b2ad291426ee9e6f1ed16d Reviewed-by: Eike Ziller <eike.ziller@qt.io>
This commit is contained in:
@@ -427,11 +427,6 @@ PersistentSettingsWriter::PersistentSettingsWriter(const FilePath &fileName, con
|
|||||||
m_fileName(fileName), m_docType(docType)
|
m_fileName(fileName), m_docType(docType)
|
||||||
{ }
|
{ }
|
||||||
|
|
||||||
PersistentSettingsWriter::~PersistentSettingsWriter()
|
|
||||||
{
|
|
||||||
write(m_savedData, nullptr);
|
|
||||||
}
|
|
||||||
|
|
||||||
bool PersistentSettingsWriter::save(const QVariantMap &data, QString *errorString) const
|
bool PersistentSettingsWriter::save(const QVariantMap &data, QString *errorString) const
|
||||||
{
|
{
|
||||||
if (data == m_savedData)
|
if (data == m_savedData)
|
||||||
|
@@ -52,7 +52,6 @@ class QTCREATOR_UTILS_EXPORT PersistentSettingsWriter
|
|||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
PersistentSettingsWriter(const FilePath &fileName, const QString &docType);
|
PersistentSettingsWriter(const FilePath &fileName, const QString &docType);
|
||||||
~PersistentSettingsWriter();
|
|
||||||
|
|
||||||
bool save(const QVariantMap &data, QString *errorString) const;
|
bool save(const QVariantMap &data, QString *errorString) const;
|
||||||
#ifdef QT_GUI_LIB
|
#ifdef QT_GUI_LIB
|
||||||
|
Reference in New Issue
Block a user