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

Qt Qml: sometimes properties expressions are evaluated twice during initialization

    XMLWordPrintable

Details

    • Bug
    • Resolution: Done
    • P1: Critical
    • 5.11.0 Beta 2
    • 5.6.3, 5.7.1, 5.9.3, 5.10.0
    • None
    • Tested on:

      Bug: Linux 5.9.3, 5.10,SailfishOS 5.6.3, iOS 5.7.1

      Works: Windows 5.5.1

    Description

       

      I think that example is self explanatory. getTmp1Value function is called twice during property initialization phase. It seems a regression - on Qt < 5.6 it works as expected - called once

      import QtQuick 2.0
      
      QtObject {
          property int tmp0: tmp1 + 1
          property int tmp1: getTmp1Value()
      
          function getTmp1Value() {
              console.log("getTmp1Value should be called only once");
              return 1;
          }
      }

       I emphasize that changing order of properties fixes the bug:

      property int tmp1: getTmp1Value()
      property int tmp0: tmp1 + 1
      

       

       

      Attachments

        Issue Links

          Activity

            People

              shausman Simon Hausmann
              tolszak Tomasz Olszak
              Votes:
              3 Vote for this issue
              Watchers:
              9 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: