Details
-
Bug
-
Resolution: Unresolved
-
P2: Important
-
None
-
5.9.0, 5.15.2
-
None
Description
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.