Details
-
Bug
-
Resolution: Out of scope
-
P4: Low
-
4.4.2
-
None
Description
QSettings object not destroyed properly on Mac.
If a QSettings object is created, and tries to write to a file, but fails (nothing written to the file), and is then destroyed. Creating a new object that reads from that file, will contain the information that was not written.
QSettings::Scope accessMode = QSettings::SystemScope; QString path("Permission"); QString key("AccessMode"); QDateTime *dt = new QDateTime; QString value = dt->currentDateTime().toString("ddhhmmss"); { QSettings testSetting(accessMode, "QSettingsTest", path); testSetting.setValue(key, value); QMessageBox::information(NULL,"Writeable?",QString("Is writable: %1").arg(testSetting.isWritable())); } QCoreApplication::flush(); QSettings testSettingTwo(accessMode, "QSettingsTest", path); qDebug() << value << "vs." << testSettingTwo.value(key).toString(); if (testSettingTwo.value(key).toString() != value) { QMessageBox::information(NULL, "QSettings Test", "No SystemScope access. Access changed to UserScope."); accessMode = QSettings::UserScope; } else QMessageBox::information(NULL, "QSettings Test", "SystemScope access. Everything is OK");