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

QML metatype life cycle management is fundamentally broken

    XMLWordPrintable

    Details

      Description

      We automatically call QQmlMetaType::freeUnusedTypesAndCaches() from

      1. the QQmlEngine dtor
      2. the QJSEngine dtor (after having it called in ~QQmlEngine() already)
      3. the QQmlTypeLoader dtor (again ...)

      This operation selectively deletes types from the type registry and has the potential of leaving incomplete modules. As we don't clear the cache of loaded "plugins" (either plugins or just type registrations), the types won't be re-loaded when we need them again in a new QQmlEngine.

      The reason this has never surfaced ... drumroll ... is that freeUnusedTypesAndCaches() does pretty much nothing under normal conditions. Most QQmlType instances are inserted twice into the registry. Once for their actual type, and once for their QQmlListProperty type. We check for refcount == 1 to determine if we can "safely" remove a type. The refcount is always 2 for types that come with lists.

      There are a few type registrations that don't register lists or only register lists. It should be possible to exercise this bug.

        Attachments

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

          Activity

            People

            Assignee:
            ulherman Ulf Hermann
            Reporter:
            ulherman Ulf Hermann
            Votes:
            1 Vote for this issue
            Watchers:
            1 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved:

                Gerrit Reviews

                There are no open Gerrit changes