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

Working with multiple QSettings instances with UTF-8 codec messes up ini file

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: P3: Somewhat important P3: Somewhat important
    • None
    • 5.1.1, 5.2.0, 5.3.1
    • Core: Other
    • None

      I currently experienced degrading performance when testing a settings dialog. We store our settings to .ini files (utf-8) and it turned out the file has grown to about 2MB, although it only contained a few entries. I examined the problem more deeply and it seems something is going wrong when working with multiple QSettings instances at a time (one method creates an instance, calls another method which creates its own instance).

      What I think might cause the problem: In the QSettings constructor, ensureAllSectionsParsed() can be called, but at this time, the object is not yet configured with an iniCodec. The documenation states the codec must be set immediately after creating the QSettings object, before accessing any data. We do this right after creating our instances, but it seems this is too late.

      I prepared a small program with two test cases:

      • first test case causes the utf-8 values to be written as ini escape sequences
      • second test case produces unreadable values. Not sure what happens there, maybe a problem with encoding the values twice.

      Both test cases cause the ini file to grow with every invocation of the program.

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

            thiago Thiago Macieira
            bwoester Benjamin Wöster
            Votes:
            2 Vote for this issue
            Watchers:
            6 Start watching this issue

              Created:
              Updated:

                There are no open Gerrit changes