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

Regression [5.7.1 -> 5.9.1] Changing a QML singleton creates a cache issue leading to undefined behaviours

    XMLWordPrintable

Details

    Description

      1 - Create a QML singleton,
      2 - Compile with a working code and run the app :

      Singleton.qml :

      pragma Singleton
      import QtQuick 2.7
      
      QtObject
      {
          id : themePalette
          property color textColor : "red"
      }
      
      main.qml :
      
      import QtQuick 2.7
      import QtQuick.Controls 2.0
      import QtQuick.Layouts 1.0
      import QtGraphicalEffects 1.0
      import QtQml.Models 2.1
      import UIComponents 1.0
      
      ApplicationWindow {
          visible: true
          width: 800
          height: 900
          title: qsTr("EOS Designer")
      
          Rectangle {
              color : UIPalette.textColor
              anchors.fill : parent
      
          }
      }
      

      3 - Make a change on singleton :
      Singleton.qml :

      pragma Singleton
      import QtQuick 2.7
      
      QtObject
      {
          id : themePalette
          property color anotherproperty : "blue"
          property color textColor : "red"
      }
      

      4 - Rerun the App, rectangle now appears in blue !
      Clearly a caching bug as qputenv("QML_DISABLE_DISK_CACHE", "1") in main.cpp solves this.

      Tested with QtCreator and visual Studio with msvc2015.
      We lost a lot of time with this, thanks for fixing.

      A test project is linked as attachement.

      Attachments

        Issue Links

          For Gerrit Dashboard: QTBUG-62243
          # Subject Branch Project Status CR V

          Activity

            People

              shausman Simon Hausmann
              mathieut Mathieu TOURNIER
              Votes:
              1 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Gerrit Reviews

                  There are no open Gerrit changes