Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-3355

QSettings object not destroyed properly on Mac

    XMLWordPrintable

Details

    • macOS

    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");
      

      Attachments

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            thiago Thiago Macieira
            roschern Nils Christian Roscher-Nielsen (Inactive)
            Votes:
            1 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes