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

QAbstractState comparison methods return wrong result for sibling states

    XMLWordPrintable

Details

    • Bug
    • Resolution: Done
    • P3: Somewhat important
    • 5.0.0
    • 4.8.1
    • Core: State Machine
    • None
    • 268216570881cfc7d066d8183047d05829e1248b

    Description

      This is an excerpt from QStateMachinePrivate::stateEntryLessThan:

      if (s1->parent() == s2->parent()) {
          return s1->children().indexOf(s1)
              < s2->children().indexOf(s2);
      }
      

      Because QObject can't be its own child, when the two QAbstractState instances have same parent, method always returns (-1 < -1) => false. Apparently the correct code should be:

      if (s1->parent() == s2->parent()) {
          return s1->parent()->children().indexOf(s1)
              < s2->parent()->children().indexOf(s2);
      }
      

      The same fix also applies to QStateMachinePrivate::stateExitLessThan.

      Attachments

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

        Activity

          People

            kenthans Kent Hansen (Inactive)
            jadam Jakub Adam
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes