Fix power outage logout only by fsync.

This commit is contained in:
John Preston 2020-02-14 18:11:32 +04:00
parent 555fe70df3
commit 3bb9e8c7eb
1 changed files with 9 additions and 0 deletions

View File

@ -269,6 +269,9 @@ struct FileWriteDescriptor {
} else {
qSwap(toWrite[0], toWrite[1]);
}
toDelete = toWrite[1];
} else if (toWrite1.exists()) {
toDelete = toWrite[1];
}
}
@ -332,10 +335,16 @@ struct FileWriteDescriptor {
fsync(file.handle());
#endif // Q_OS_WIN
file.close();
if (!toDelete.isEmpty()) {
QFile::remove(toDelete);
}
}
QFile file;
QDataStream stream;
QString toDelete;
HashMd5 md5;
int32 dataSize = 0;