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

Inconsistencies regarding list and value type property manipulations

XMLWordPrintable

    • ec58c0ddb (dev), 20374ccf7 (6.5), 3d924d59d (dev), 09003edcc (6.5)

      If you read from and write to the same value type list property in a QML function, the interpreter will probably update any "references" to the list as soon as it's written to, but the compiler will create a true copy of the list, that doesn't get updated.

      This may be the same for any value type. We may need to invalidate any possible references whenever an operation with potential side effects takes place.

      This produces NaN when interpreted and a number when aot-compiled.

          property list<double> numbers: {
              var result = [];
              for (var i = 0; i < Categorizer.Length; ++i)
                  result[i] = randomNumber();
              return result;
          }
      
          function evil() : double {
              var numbers = root.numbers;
              var a = 0;
              for (var j = 0; j < Categorizer.Length; ++j) {
                  a += numbers[j];
                  root.numbers = [a, a, a]
              }
              return a;
          }
      

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

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

              Created:
              Updated:
              Resolved: