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

createQmlObject fails if the qml String has a line with more than 4096 bytes

    XMLWordPrintable

Details

    Description

      I create a QML object with the function createQmlObject  and a very long qml String (more than 7KB in only one line)

      In Debug mode, it throws a debug error:

       

      Program: C:\Qt\6.2.1\msvc2019_64\bin\Qt6Cored.dll
      Module: 6.2.1
      File: C:\Users\qt\work\qt\qtdeclarative\include\QtQml\6.2.1\QtQml\private\../../../../../src/qml/common/qv4compileddata_p.h
      Line: 144
      ASSERT: "column == c" in file C:\Users\qt\work\qt\qtdeclarative\include\QtQml\6.2.1\QtQml\private\../../../../../src/qml/common/qv4compileddata_p.h, line 144
      

      If we analyse the qv4compileddata_p.h source code:

      struct Location
      {
       union {
       quint32 _dummy;
       quint32_le_bitfield<0, 20> line;
       quint32_le_bitfield<20, 12> column;
       };
       Location() : _dummy(0) { }
       Location(quint32 l, quint32 c)
       : Location()
       {
       line = l;
       column = c;
       Q_ASSERT(line == l);
       Q_ASSERT(column == c);          // line 144
       }

      It appears that the pair (line,column) is stored in a 32bit location, with 20 bits for the line number and 12 bits for the column.

      So a line length has to be inferior to 4096.

      This limitation should be added to the documentation.

       

      Attachments

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

        Activity

          People

            fabiankosmale Fabian Kosmale
            remy67 remy rouvin
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated: