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

Double-Initialisation of values upon QObject creation

    XMLWordPrintable

Details

    Description

      When having an object B which is declared within an object A, and A is passed to B as a property, properties of A that are accessed by B will be initialized twice.

      This also happens, if I reference an object that is declared in another file by it's id, but seemingly not when referenced by parent.

      This can be problematic, as e.g. propertyChanged-signals are fired.
      Also, if used with dynamic object creation, it can lead to significant overhead, as possibly large objects are created twice which takes time, and if the first object is not manually destroyed will be a source for memory leakage.

      Maybe a check, whether the property is already initialised could be implemented.

      Attachments

        1. main.cpp
          0.5 kB
          Michael
        2. TestObj.qml
          0.7 kB
          Michael
        3. TestObj1.qml
          0.1 kB
          Michael
        4. TestQuick1.qml
          0.1 kB
          Michael

        Issue Links

          Activity

            People

              shausman Simon Hausmann
              derm Michael
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: