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

[REG: 6.8.2 → 6.8.3] Inconsistent behavior of QQmlEngine::clearComponentCache

    XMLWordPrintable

Details

    • All

    Description

      This sample app updates the component periodically whenever the source of MyItem.qml is changed. It works also for more complex hierarchies, changes in sub-components would be also reloaded.

      import QtQuick
      import QtQuick.Controls
      import Test
      ApplicationWindow {
          visible: true
          Loader {
              id: loader
              source: "MyItem.qml"
              anchors.fill: parent
          }
          Timer {
              repeat: true
              interval: 300
              running: true
              onTriggered: {
                  const src = loader.source
                  loader.source = ""
                  Qt.callLater(() => {
                      CacheCleaner.clearComponentCache()
                      loader.source = src
                  })
              }
          }
      }
       
      

      The call CacheCleaner.clearComponentCache() calls engine->clearComponentCache()

       

      This code always worked fine until Qt 6.8.2.

      However, since 6.8.3 it works sometimes, unpredictably, depending on the loaded component or sub-components content.

      If MyItem.qml is as follows:

       

       

      import QtQuick
      import QtQuick.Controls
      Button {
          text: `some text ${this}, ${this instanceof Button}`
          // when uncommented reloading stops working (Qt 6.8.3 and higher)
          //font.family: "Tahoma"
      }
      

      it works fine, but using some specific properties like font.family causes it stops working, the type remains in cache and finally the content is not reloaded.

      This ticket is follow up to https://bugreports.qt.io/browse/QTBUG-135448 which was marked as invalid because cache cleanup request was called right after `destoroy` of the component. Here the situation is different, the cleanup is queued via Qt.callLater.

       

       

      Attachments

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

        Activity

          People

            qtqmlteam Qt Qml Team User
            michalc Michał Cieślak
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:

              Gerrit Reviews

                There are no open Gerrit changes