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

Array manipulation destroys objects in array

XMLWordPrintable

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

      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.

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

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

              Created:
              Updated:
              Resolved:

                There are no open Gerrit changes