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

QML Settings fails persistence

    XMLWordPrintable

Details

    • Bug
    • Resolution: Done
    • P1: Critical
    • 5.13.0 Beta 1
    • 5.11.0
    • Quick: Other
    • None
    • Android
    • f82c8ed1ef7b0f1150efe481a247260c382179c0

    Description

      On Android an application can be closed by first being backgrounded and then cleared, in which case Qt.application.state will transition to Qt.ApplicationInactive and then Qt.ApplicationSuspended, whereafter it will just get killed. No destructors called.

      In that case, the QML Settings component doesn't properly persist its properties.

      In the attached out.log can be seen the debug output of three separate launches of the minimal app also attached.

       

      1. The value of foo is the default value of 1.23. The app is closed via the Android back button, resulting in a proper close. A new value of 0.372 is written to foo before close.
      2. The value of foo is 0.372, as set in the previous launch. The app is closed by first backgrounding it and then clearing it. A new value of 0.132 is written to foo, before the app is killed.
      3. The value of foo is still 0.372, as it was before the second launch. The Settings component failed to persist the new value of 0.132 to foo.

       

      Expected behaviour would be for the new value of 0.132 to be persisted.

      One possible solution would be to expose the sync() method of the inner QSettings pointer to the outside QML component.

      That way it would be possible to explicitly trigger a save from within QML to make sure properties are persisted as soon as the app is backgrounded.

      Attachments

        1. out.log
          16 kB
        2. settingsexample.tar.gz
          2 kB
        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            paangele Paolo Angelelli
            rhardih René Hansen
            Votes:
            2 Vote for this issue
            Watchers:
            7 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes