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

ListView crash during incubation of delegate with State using when

    XMLWordPrintable

Details

    Description

      When a ListView is created inside of a component loaded by a Loader, and then the Loader's source or sourceComponent changes, it is possible that the ListView may continue incubating delegates even after it has been removed by the Loader. At this point, if the ListView's delegate contains an Item containing a State with a "when" property, the application will crash. The crash occurs while attempting to evaluate the QQmlBinding for the State's "when" property due to de-referencing the QQmlEngine from the binding's context, which at this point is null due to being unloaded. (See stack trace, disassembly images below)

       

       

      I've attached a small example to reproduce the issue. Simply click on the window several times until the crash occurs. It should occur within a few times of clicking.

       

      A simple workaround for the crash is to place the entire ListView delegate in a Loader of its own.

       

      Note that this issue affects Qt 5.12, but does not affect Qt 5.15, likely due to refactoring that took place in QQuickStateGroup and other possibly other locations. However, since this crash can easily result from entirely valid and reasonable QML code, we would ask that it be fixed in the Qt 5.12 LTS line.

      Attachments

        Issue Links

          Activity

            People

              qt.team.quick.subscriptions Qt Quick and Widgets Team
              zcapalbo Zachary Capalbo
              Votes:
              4 Vote for this issue
              Watchers:
              9 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: