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

QML JavaScript crash when deleting property in for-in loop

    XMLWordPrintable

Details

    • Windows
    • 7e32be87c0f53ce2e5d3c1e351a559d6c600f1bf (qt/qtdeclarative/5.12)

    Description

      The following code crashes:

      function test() {
          var obj = { 1: null, 2: null, 4096: null }
          for (var t in obj)
              if (t == 2)
                  delete obj[t]
          }
      
      
      

      For it to crash, the object must have all numeric property names, at least one must be larger than 4095, and a for-in loop must delete one of the properties other than the last. It crashes when it tries to do the next iteration of the loop. It doesn't seem to happen on a Mac.

      The only workaround I've found is to include a non-numeric property, and explicitly skip over it in my for-in loop.

      This may be related to https://bugreports.qt.io/browse/QTBUG-61356.

      Attachments

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

        Activity

          People

            ulherman Ulf Hermann
            pderocco Paul DeRocco
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes