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

QSettings incompatible when reading a config written with Qt6 from Qt5

    XMLWordPrintable

Details

    • Bug
    • Resolution: Unresolved
    • P3: Somewhat important
    • None
    • 5.15.9
    • Core: Date/Time
    • None
    • All

    Description

      This is a follow up for QTBUG-102334.

      The mentioned bugreport suggests to set the file encoding via

       

      settings.setIniCodec("UTF-8");

      in the Qt5 application. This works mostly, but sadly not always. There are race conditions, where QSettings is instanciated from various places, and it want's to do something with the settings right now - before I've a chance to set the ini codec at all.

      1   operator<<                                                                                                                                                                    qtimezone.cpp         980  0x7ffff2338a2a 
      2   operator<<                                                                                                                                                                    qdatetime.cpp         5737 0x7ffff232e129 
      3   (anonymous namespace)::FilteredOperatorSwitch<QDateTime, true>::save                                                                                                          qmetatype.cpp         1466 0x7ffff2455ce0 
      4   (anonymous namespace)::SaveOperatorSwitch::delegate<QDateTime>                                                                                                                qmetatype.cpp         1508 0x7ffff2455ce0 
      5   QMetaTypeSwitcher::switcher<bool, (anonymous namespace)::SaveOperatorSwitch>                                                                                                  qmetatypeswitcher_p.h 74   0x7ffff2455ce0 
      6   QMetaType::save                                                                                                                                                               qmetatype.cpp         1616 0x7ffff2455ce0 
      7   QVariant::save                                                                                                                                                                qvariant.cpp          2599 0x7ffff24875b0 
      8   operator<<                                                                                                                                                                    qvariant.cpp          2625 0x7ffff248779f 
      9   QSettingsPrivate::variantToString                                                                                                                                             qsettings.cpp         460  0x7ffff23c83a9 
      10  QConfFileSettingsPrivate::writeIniFile                                                                                                                                        qsettings.cpp         1897 0x7ffff23cdb0a 
      11  QConfFileSettingsPrivate::syncConfFile                                                                                                                                        qsettings.cpp         1515 0x7ffff23ce85a 
      12  QConfFileSettingsPrivate::sync                                                                                                                                                qsettings.cpp         1367 0x7ffff23ceb93 
      13  QSettings::~QSettings                                                                                                                                                         qsettings.cpp         2763 0x7ffff23c42a6 
      14  QSettings::~QSettings                                                                                                                                                         qsettings.cpp         2768 0x7ffff23c42c9 
      15  std::default_delete<QSettings>::operator()                                                                                                                                    unique_ptr.h          79   0xad3847       
      16  std::unique_ptr<QSettings, std::default_delete<QSettings>>::~unique_ptr                                                                                                       unique_ptr.h          361  0xad3847       
      ... <More>                                                                                                                                                                                                                  
      

      In this case, it would be good to have some static way to set the ini codec, while the application is being initialized.

      So there's still no chance to run both Qt5 / Qt6 dev at the same time.

       

      Attachments

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

        Activity

          People

            cnn Qt Core & Network
            cajus Cajus Pollmeier
            Vladimir Minenko Vladimir Minenko
            Alex Blasche Alex Blasche
            Votes:
            1 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

              Created:
              Updated:

              Gerrit Reviews

                There are no open Gerrit changes