mirror of
https://bitbucket.org/smil3y/katie.git
synced 2025-02-24 19:02:59 +00:00
read settings file before truncating it in QSettingsPrivate::write()
Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
This commit is contained in:
parent
755597abe0
commit
ebc8f7525c
1 changed files with 7 additions and 7 deletions
|
@ -286,13 +286,6 @@ void QSettingsPrivate::write()
|
|||
}
|
||||
|
||||
QMutexLocker locker(qSettingsMutex());
|
||||
QFile writefile(filename);
|
||||
if (Q_UNLIKELY(!writefile.open(QFile::WriteOnly))) {
|
||||
status = QSettings::AccessError;
|
||||
qWarning("QSettingsPrivate::write: failed to open %s", filename.toLocal8Bit().constData());
|
||||
return;
|
||||
}
|
||||
|
||||
QSettings::SettingsMap mergemap;
|
||||
QFile readfile(filename);
|
||||
if (readfile.open(QFile::ReadOnly)) {
|
||||
|
@ -302,6 +295,13 @@ void QSettingsPrivate::write()
|
|||
mergemap.insert(key, map.value(key));
|
||||
}
|
||||
|
||||
QFile writefile(filename);
|
||||
if (Q_UNLIKELY(!writefile.open(QFile::WriteOnly))) {
|
||||
status = QSettings::AccessError;
|
||||
qWarning("QSettingsPrivate::write: failed to open %s", filename.toLocal8Bit().constData());
|
||||
return;
|
||||
}
|
||||
|
||||
if (Q_UNLIKELY(!writeFunc(writefile, mergemap))) {
|
||||
status = QSettings::FormatError;
|
||||
qWarning("QSettingsPrivate::write: could not write %s", filename.toLocal8Bit().constData());
|
||||
|
|
Loading…
Add table
Reference in a new issue