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

[REG 6.6 → 6.7] bogus "TypeError: Cannot read property 'Foo' of undefined" error when using enums

    XMLWordPrintable

Details

    • 9b87e051c (dev), 000538769 (6.7)

    Description

      Testing Qt 6.7 gives unexpected errors in some KDE code. https://invent.kde.org/nicolasfella/qml-enum-test is a condensed example.

      The error occurs in the Separator component when accessing the enum values defined in this file:

       

      file:///home/nico/kde/usr/qml/org/kde/mymodule/Separator.qml:15: TypeError: Cannot read property 'Light' of undefined
      
      file:///home/nico/kde/usr/qml/org/kde/mymodule/Separator.qml:13: TypeError: Cannot read property 'Normal' of undefined 

      The example should show a horizonal line, but it doesn't work. Running the example a second time works as expected. After clearing the qml cache (rm -r ~/.cache/foo) it is broken again.

      The qml module provides the Separator component and registers the QML file via qmlRegisterType(QUrl, ...). Without this everything works as expected.

      To make the example work it must be installed. To install the QML module I copied some code from extra-cmake-modules to work around QTBUG-100102

      Tested with current 6.7 branch (qtbase 98af9bd9d363ff5f8525bebe0e6be431679881ff, qtdeclarative 44126abbdbd49b7764e23deb2c03f40f98e660c5). It works as expected with 6.6

       

       

      Attachments

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

        Activity

          People

            ulherman Ulf Hermann
            nicolasfella Nicolas Fella
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes