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

Setters for QProperty-based properties should not register observers on those properties

    XMLWordPrintable

Details

    • Epic
    • Resolution: Unresolved
    • P2: Important
    • None
    • 6.5, 6.6.0 FF
    • Core: Other
    • None
    • Do not register property setters as dependencies of the properties they set

    Description

      This was found when investigating a binding loop on QObject::setObjectName, but there probably are more occurrences of the same pattern. The pattern is:

          if (d->extraData->objectName != name) {
              d->extraData->objectName.setValueBypassingBindings(name);
              d->extraData->objectName.notify(); // also emits a signal
          }
      

      By reading objectName in the first line, we register an observer on the QProperty. This is not what we want. Rather, if we need the value, we should read it bypassing the binding:

          if (d->extraData->objectName.valueBypassingBindings() != name) {
              d->extraData->objectName.setValueBypassingBindings(name);
              d->extraData->objectName.notify(); // also emits a signal
          }
      

      Attachments

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

        Activity

          People

            cnn Qt Core & Network
            ulherman Ulf Hermann
            Vladimir Minenko Vladimir Minenko
            Alex Blasche Alex Blasche
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

              Created:
              Updated:

              Gerrit Reviews

                There are no open Gerrit changes