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

Array manipulation destroys objects in array

    XMLWordPrintable

Details

    • 64777c3ed9dc66e3510ce2139538b93ad68e9fbb (qt/qtdeclarative/dev) c8810492c204546ad12c0635fd72b649fe563097 (qt/qtdeclarative/6.2)

    Description

      Consider the following code snippet:

          QString code(QStringLiteral(R"QBS(
                  var test = ['val2'];
                  test.unshift('val1');
                  test = test.concat([]);
                  throw(JSON.stringify(test));
          )QBS"));
          QJSEngine e;
          QJSValue v = e.evaluate(code);
          qDebug() << v.toString(); 

      The output is:

      "[\"val1\",null]" 

      I was not able to reduce it further. The array can be initialized like above or filled with push. But it must contain something before doing unshift followed by an empty concat.

      Attachments

        Issue Links

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

          Activity

            People

              fabiankosmale Fabian Kosmale
              rweickelt Richard Weickelt
              Votes:
              1 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Gerrit Reviews

                  There are no open Gerrit changes