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

Child states added while running are not reachable



    • Bug
    • Resolution: Unresolved
    • P2: Important
    • None
    • 5.9.0, 5.15.2
    • None
    • Windows


      The documentation of QStateMachine indicates that removing states while running is discouraged, but does not mention adding states while running. This behaves oddly (see attached test)

      • OK: Add a sibling state before starting
        • PASS : QStateMachineInitialStateIssue::existingStateOk()
      • OK: Add a sibling state while running
        • PASS : QStateMachineInitialStateIssue::addSiblingStateWhileRunningOk()
      • OK: Add an initial child state before starting
        • PASS : QStateMachineInitialStateIssue::existingChildOk()
      • NOK: Add an initial child state while running
        • FAIL! : QStateMachineInitialStateIssue::addChildWhileRunningFail() 'childStateEntered.wait()' returned FALSE. ()

      It appears the state machine isn't aware of new children added while running and cannot transition to the newly added children. Also, one could argue it should transition to the new initial child when setting the new child state as the initial one.

      Restarting the entire state machine is a workaround: once restarted, the child state will be activated because it's the initial one. But: this looses the entire state, which is undesirable in my application.

      Please advise on how to handle this scenario. 


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



            ulherman Ulf Hermann
            koen.poppe koen.poppe
            0 Vote for this issue
            2 Start watching this issue



              Gerrit Reviews

                There are no open Gerrit changes