Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Don't allow disabling SVS from substates
SVS keeps track of a stack of states which need to correspond to the current goal state. `state_creation_callback` and `state_deletion_callback` are called when goal states are created/deleted, and SVS updates its stack. `state_deletion_callback` has an `assert` to check that the state passed to it is the same one that is being popped; the two stacks must always stay in sync, and the assert checks for this invariant. If disabling SVS is allowed in substates, we can break the invariant like this: * Start with SVS enabled (which is the default). Let's call the top state S1. * Go two subgoals deep (S3) * After S3 returns to S2, enable SVS again * When S2 returns, `svs::state_deletion_callback` will be called. `state_stack` will have S3 on top, since we skipped `svs::state_deletion_callback` while SVS was disabled. * Therefore, `assert(state == s->get_state());` will fail To prevent this case, we fail attempts to disable SVS while within a subgoal. This is probably a corner-case, but it ensures that we can maintain the invariant and not throw an `assert` exception (or hit undefined behavior when we call `pop_back` on an empty `std::vector`!). See #475.
- Loading branch information