-
Bug
-
Resolution: Unresolved
-
P3: Somewhat important
-
None
-
5.10.0
-
None
-
Windows 10, MinGW 5.3 (x32)
QSettings::sync() sets AccessError, when working with QTemporaryFile.
Example test case:
void TestTempSettings()
{
QTemporaryFile temp("temp_settings_XXXXXX.ini");
if (temp.open())
{
temp.close();
qDebug() << "Temp file is closed: " << !temp.isOpen();
QSettings tempSets(temp.fileName(), QSettings::IniFormat);
tempSets.setValue("TestValue", "test");
qDebug() << "Value set status: " << tempSets.status();
tempSets.sync();
qDebug() << "QSettings sync status:" << tempSets.status();
}
else
{
qDebug() << "Failed to open temp file" << temp.errorString();
}
}
int main(int argc, char *argv[])
{
Q_UNUSED(argc)
Q_UNUSED(argv)
TestTempSettings();
}
Output:
Temp file is closed: true
Value set status: QSettings::Status(NoError)
QSettings sync status: QSettings::Status(AccessError)
Nothing is actually written to temporary file, though it seems to be closed and write-ready. Same code worked seamlessly at least with Qt 5.3.
General QFile was able to write to temporary file without errors.