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

Overriding property change signals causes a crash

    XMLWordPrintable

Details

    • 4317c442fd492121e2fc037a39b40653bbc34294

    Description

      Overriding an automatically generated property change signal can cause a crash in some circumstances, and it causes incorrect behaviour in other circumstances.

      import QtQuick 2.0
      
      Item {
      
          property int a: 10
          onAChanged: console.log("onAChanged")
      
          // either of the following two lines causes the issue
          signal aChanged()
          //function aChanged() { console.log("aChanged"); }
      
          // note that automatic emission now fails also
          Component.onCompleted: {
              a = 20
          }
      
          // you need a certain number of properties to trigger the issue
          property int b
          property int c
          property int d
          property int e
          property int f
          property int g
          property int h
          property int i
          property int j
          property int k
          property int l
      }
      

      We should disallow property change notifications to be overridden. If the client wishes to provide their own notifications (eg, to provide parameters like old/new values) they should use a different signal name instead.

      Attachments

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

        Activity

          People

            chriadam Christopher Adams (closed Nokia identity) (Inactive)
            chriadam Christopher Adams (closed Nokia identity) (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes